![]() |
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 |
Re: Showing more than 1 News story on the Home page
anybody got solution for this change?
|
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} Try adding that to news.tpl checking first if any of the variables have changed between versions. |
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 |
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.
|
Re: Showing more than 1 News story on the Home page
I'm using 4.44 now
|
Re: Showing more than 1 News story on the Home page
Use webmaster mode - it shows you the available variables and their contents.
--- |
Re: Showing more than 1 News story on the Home page
Quote:
Have you tried this? Code:
{* 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. |
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. |
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 |
Re: Showing more than 1 News story on the Home page
Thanks for your help, but I still don't understand this exactly. I'm not an expert in smarty.
|
Re: Showing more than 1 News story on the Home page
Chi, you are going to need to do this in php to assign the variable to smarty, then you can access it in your tpl.
Look at news_manage.php, and see how the variable is being assigned to smarty, and the queries that are being used. Then do a recursive search of your X-cart to see where the current news_message variable is being assigned, and then insert your example logic there. After that is complete you will have passed the variable to smarty, and you can then work with it in templates like you would any other. You are probably going to need a {section} or {foreach} loop to go through your newly assigned array and display each message in the template. Definitely not for the faint of heart. ;) I can do this for you if you like, that's what I do. -Mike |
Re: Showing more than 1 News story on the Home page
thanks. Will give it a try
|
All times are GMT -8. The time now is 04:44 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.