Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Showing more than 1 News story on the Home page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-20-2011, 11:55 AM
 
rhu rhu is offline
 

Advanced Member
  
Join Date: Dec 2007
Posts: 63
 

Default Showing more than 1 News story on the Home page

I'm trying to show 5 news message on the home page, but I noticed from the debugging tool that the $news_message only has one story in the array.

In news.php however, there's a new variable called $news_messages which has multiple stories...

How can I get access to that $news_messages variable from the home page?


I was able to find this thread which talks about exactly what I need, but it doesn't work for 4.4.x

http://forum.x-cart.com/showthread.php?t=48437 - looks like it's only valid for 4.3 and 4.2
__________________
X-Cart 4.3.0 Gold
Reply With Quote
  #2  
Old 11-26-2011, 08:09 PM
 
chiactivate chiactivate is offline
 

Senior Member
  
Join Date: Feb 2007
Location: Canada
Posts: 148
 

Default Re: Showing more than 1 News story on the Home page

anybody got solution for this change?
__________________
www.ChiMassager.com
X-cart Version 4.44

www.SEOMarketing30days.com
--> Download FREE SEO marketing Ebook (valued $50)
Attract more visitors and sales with top 5 most powerful SEO marketing strategies. Converting visitors into buyers, not just traffic!
Reply With Quote
  #3  
Old 11-28-2011, 08:35 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Showing more than 1 News story on the Home page

The heart of the display appears to be...

Code:
{insert name="gate" func="news_get_num" assign="all_news" lngcode=$shop_language} {section name=newsloop loop=$all_news} <div class="newsitem"> <strong> {$all_news[newsloop].date|date_format:$config.Appearance.date_format}</strong><br /> {$all_news[newsloop].body}<br /> </div> {/section}

Try adding that to news.tpl checking first if any of the variables have changed between versions.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #4  
Old 11-29-2011, 05:07 PM
 
chiactivate chiactivate is offline
 

Senior Member
  
Join Date: Feb 2007
Location: Canada
Posts: 148
 

Default Re: Showing more than 1 News story on the Home page

it didn't work.

By the way, where are these variables stored?

$news_message.date
$all_news

I mean how do you find the right variable and what do they all mean?

Still haven't figured out how this smarty works. Your help is appreciated.

Thanks
__________________
www.ChiMassager.com
X-cart Version 4.44

www.SEOMarketing30days.com
--> Download FREE SEO marketing Ebook (valued $50)
Attract more visitors and sales with top 5 most powerful SEO marketing strategies. Converting visitors into buyers, not just traffic!
Reply With Quote
  #5  
Old 11-30-2011, 04:37 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Showing more than 1 News story on the Home page

I no longer have a copy of 4.0.x to look at, sorry.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #6  
Old 12-02-2011, 12:45 PM
 
chiactivate chiactivate is offline
 

Senior Member
  
Join Date: Feb 2007
Location: Canada
Posts: 148
 

Default Re: Showing more than 1 News story on the Home page

I'm using 4.44 now
__________________
www.ChiMassager.com
X-cart Version 4.44

www.SEOMarketing30days.com
--> Download FREE SEO marketing Ebook (valued $50)
Attract more visitors and sales with top 5 most powerful SEO marketing strategies. Converting visitors into buyers, not just traffic!
Reply With Quote
  #7  
Old 12-02-2011, 03:50 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Showing more than 1 News story on the Home page

Use webmaster mode - it shows you the available variables and their contents.

---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote

The following user thanks gb2world for this useful post:
chiactivate (12-06-2011)
  #8  
Old 12-03-2011, 05:10 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Showing more than 1 News story on the Home page

Quote:
Originally Posted by chiactivate
I'm using 4.44 now

Have you tried this?
Code:
{* $Id: news.tpl,v 1.1 2010/05/21 08:31:51 joy Exp $ vim: set ts=2 sw=2 sts=2 et: *} {if $active_modules.News_Management} {insert name="gate" func="news_exist" assign="is_news_exist" lngcode=$shop_language} {if $is_news_exist} {insert name="gate" func="news_subscription_allowed" assign="is_subscription_allowed" lngcode=$shop_language} <div class="news-box"> <div class="news"> <h2>{$lng.lbl_news}</h2> {if $news_message eq ""} {$lng.txt_no_news_available} {else} {* Added loop from news_archive.tpl *} {foreach from=$news_messages item=m name=news} <div{interline name=news additional_class="news-item"}> <div class="news-date">{$m.date|date_format:$config.Appearance.date_format}</div> <div class="news-title">{$m.subject|amp}</div> <div class="news-body"> {if $m.allow_html eq "N"} {$m.body|escape|nl2br} {else} {$m.body|amp} {/if} </div> </div> {/foreach} {* Added loop from news_archive.tpl END *} {* <strong>{$news_message.date|date_format:$config.Appearance.date_format}</strong><br /> {$news_message.body} *} <br /><br /> <a href="news.php" class="prev-news">{$lng.lbl_previous_news}</a> {if $is_subscription_allowed} &nbsp;&nbsp; <a href="news.php#subscribe" class="subscribe">{$lng.lbl_subscribe}</a> {/if} {/if} </div> </div> {/if} {/if}

I just added the loop from the "light and lucid 2 column" news_archive.tpl and commented out the original call for the one news message. I don't know if it will work or not but probably worth a try.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #9  
Old 12-19-2011, 06:03 PM
 
chiactivate chiactivate is offline
 

Senior Member
  
Join Date: Feb 2007
Location: Canada
Posts: 148
 

Default Re: Showing more than 1 News story on the Home page

it still didn't work. You are right. Should be copy pasting the loop from news_archive.tpl, but the doesn't work at all.

Added some dummy text inside the loop, but the dummy text didn't show up. So, I guess it didn't even go inside the loop at all.
__________________
www.ChiMassager.com
X-cart Version 4.44

www.SEOMarketing30days.com
--> Download FREE SEO marketing Ebook (valued $50)
Attract more visitors and sales with top 5 most powerful SEO marketing strategies. Converting visitors into buyers, not just traffic!
Reply With Quote
  #10  
Old 12-19-2011, 08:08 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Showing more than 1 News story on the Home page

This may be obvious, but what we are going to need to do is assign the variable $news_messages somewhere other than news.php.

In modules/News_management/news_manage.php you will see the variable assigned to smarty:
Code:
$smarty->assign('news_messages', func_news_get($shop_language, false, false, "$first_page, $objects_per_page"));

Hope that helps,

-Mike
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:31 PM.

   

 
X-Cart forums © 2001-2020