Thread: news posting
View Single Post
  #18  
Old 07-28-2007, 06:30 PM
 
MMANOR MMANOR is offline
 

Member
  
Join Date: Feb 2007
Posts: 28
 

Default Re: news posting

Quote:
Originally Posted by mrkenzie
Here is what I did, you can check out the final product at:
www.techcentrichomes.com

I changed the news list so that it shows 5 news articles in the news box. It truncates the news article, it shows the news article title, and then it links to the full news story with an anchor so it goes directly to the news article the user clicked on. It works really nice and it is easy to do.

in /modules/news_management/func.php:
Find this:
Code:
if ($only_first) { $query .= " LIMIT 1"; }

and change the 1 to how ever many you want to show on the main page (I used 5)

Then change skin1/today_news.tpl. I have included the entire page here. I also have an image before each news item. Also, I put in an anchor in news archive so when you click on the news article, it goes directly to the news article they clicked on.
Code:
{* $Id: today_news.tpl,v 1.13 2006/03/28 08:21:07 max Exp $ *} {if $news_message eq ""} {$lng.txt_no_news_available} {else} <table width="100%" cellspacing="2"> {section loop=$news_message name=curr_message} <tr> <td><img src="/skin1/images/news_icon.gif" alt="News" /></td> <td><a href="news.php#{$news_message[curr_message].newsid}">{$news_message[curr_message].send_date|date_format:$config.Appearance.date_format}<br /> {$news_message[curr_message].subject|truncate:100:""}</a></td> </tr> {/section} </table> <br /> {if $usertype eq "C"} <a href="news.php" class="SmallNote">{$lng.lbl_previous_news}</a> {/if} {/if} <hr class="VertMenuHr" size="1" />

Here is my skin1/modules/news_management/news_archive.tpl to show how to add the anchor on that page:
Code:
{* $Id: news_archive.tpl,v 1.5 2005/11/17 06:55:51 max Exp $ *} {if $news_messages eq ""} {$lng.txt_no_news_available} {else} {section name=idx loop=$news_messages} <a name="{$news_messages[idx].newsid}" id="{$news_messages[idx].newsid}" /> {capture name=dialog} <b>{$news_messages[idx].subject}</b> <br /><br /> {if $news_messages[idx].allow_html eq "N"} {$news_messages[idx].body|replace:"\n":"<br />"} {else} {$news_messages[idx].body} {/if} {/capture} {include file="dialog.tpl" title=$news_messages[idx].send_date|date_format:$config.Appearance.date_format content=$smarty.capture.dialog extra='width="100%"'} <br /> {/section} {/if}

Let me know if you have any questions or problems.

Good luck!

I used this code and it worked great except for one thing. If you can look at the link http://www.mourningnightmares.com/news.php unfortunately it created a huge white space before displaying the previous news. I did take out the line regarding an image for the links because I did not create one. What could I do differently to display the links for the news?

Thank you all in advance for your help.
__________________
x-cart-4.1.8gold
Reply With Quote