Thread: Latest news mod
View Single Post
  #1  
Old 10-16-2004, 08:50 AM
  Gijs's Avatar 
Gijs Gijs is offline
 

eXpert
  
Join Date: Aug 2004
Location: Belgium
Posts: 295
 

Default Latest news mod

Hi,

I'm using BOOMER Tabbed Menu Mod and I wanted to use it in a more diverse way: intregrating "latest news" and getting th last 10 items displayed into one of the Tabs.

The forum is great thing for learning, espcialy how fellow members resolve problems. I came across a post of Leon, when it hit me :P
http://forum.x-cart.com/viewtopic.php?t=8414


It's a very basic mod. Simply wanted a thing something else ... especially since Jon's news mod with admin function is still in beta-testing.

Let's take it step by step.

Step 1:
Create in the Admin a language variable called "lbl_news_none".
I gave this contence: "The Latest News section is empty !"

Step 2:
make a new file or edit modules/News_Management/news_last.php and change the sql part to:
Code:
# # define the first & latst news you want to retreve. Edit these values to your liking # $first=0; $last=10; $news_message = func_query("SELECT $sql_tbl[newsletter].* FROM $sql_tbl[newslists], $sql_tbl[newsletter] WHERE $sql_tbl[newsletter].listid = $sql_tbl[newslists].listid AND $sql_tbl[newslists].avail = 'Y' AND $sql_tbl[newslists].show_as_news = 'Y' AND $sql_tbl[newsletter].show_as_news = 'Y' ORDER BY $sql_tbl[newsletter].send_date DESC LIMIT $first,$last"); if (count($news_message) ==0) $news_message=""; $smarty->assign("news_message", $news_message);

Step 3:
replace the contence of today_news.tpl with:
Code:
{* $Id: today_news.tpl,v 1.10 2004/05/31 06:25:32 max Exp $ *} {capture name=latestnews} {if $news_message} <TABLE width=100% border=0 cellspacing=0 cellpadding=2> {section name=number loop=$news_message} <TR> <TD> {$news_message[number].send_date|date_format:$config.Appearance.date_format}: {$news_message[number].subject} {$news_message[number].body} <HR> </TD> </TR> {/section} </TABLE> {else} <TABLE width=100% border=0 cellspacing=0 cellpadding=2> <TR> <TD> {$lng.lbl_news_none} </TD> </TR> </TABLE> {/if} {if $usertype eq "C"} <TABLE width=100% border=0 cellspacing=0 cellpadding=2> <TR> <TD> {$lng.lbl_previous_news} </TD> </TR> </TABLE> {/if} {/capture} {include file="dialog.tpl" title=$lng.lbl_news content=$smarty.capture.latestnews extra="width=100%"}

Step 4:
For people using BOOMERS Mod:
After you've edited the js-file properly and the TAB section in cartlab-tabs.tpl.
Simply include today_news.tpl in TAB CONTENT.

Example:
BTW "Laatste Nieuws" = Dutch for "Latest News"
http://www.gbhwebsolutions.com/xcart/latestnewsmod.jpg

H.I.H.

Gijs
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote