X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   news posting (https://forum.x-cart.com/showthread.php?t=24033)

cascadegps 08-11-2006 11:19 AM

news posting
 
I am learning to use the news management and want the news to post on that right hand column box, but only show the first couple of sentences and give customers the option of clicking on it to read more. Instead the whole article post with a very long narrow scroll to read it all. Is it possible to make it only show the first paragraph or less with a link or is News Man reallly just for email subscriptions?

balinor 08-11-2006 11:41 AM

Here's what I use:

open up today_news.tpl and replace this:

{$news_message.body}

with this:

{$news_message.body|truncate:114:"...":true}...read more

change the truncate value to shrink or expand as you like.

cascadegps 08-11-2006 12:31 PM

news management
 
:) THanks. that worked just fine.

jdedba 08-11-2006 08:39 PM

This is also what I want to know.

It is strange that I search for keyword "news" in this forum and get nothing back. It seems phpBB does not store news as the searchable word. :(

Thanks a lot.

Vacman 08-12-2006 06:48 AM

Nice! I like that...

Josaram 11-08-2006 09:31 AM

Re: news posting
 
thank you as well, I needed help with this and it worked perfect

virtualstar 11-25-2006 08:57 PM

Re: news posting
 
As balinor explained above you can truncate the news. Now does anyone know if it is possible to display multiple news items? When I add a message it just displays the newest message, I would like to show the latest 5 messages.
Thanks

carpeperdiem 11-25-2006 09:32 PM

Re: news posting
 
my solution is neither elegant nor automated... I made a new .tpl and called it mm_news.tpl

I simply hardcoded my news items...

Code:

<strong>21-Nov-2006</strong><br />
<strong>  NEWS ITEM 1</strong>
<a href="http://www.link.com/link" target="_blank">link name</a> NEWS ITEM 1... NEWS ITEM 1... NEWS ITEM 1... NEWS ITEM 1... <br /><br />
<strong>08-Nov-2006</strong><br />
<strong>NEWS ITEM 2</strong>
<a href="http://www.link.org/link" target="_blank">NEWS ITEM 2 NEWS ITEM 2 NEWS ITEM 2 NEWS ITEM 2 NEWS ITEM 2 <br /><br />
{if $usertype eq "C"}
<a href="news.php" class="SmallNote">{$lng.lbl_previous_news}</a>
{/if}


and then in news.tpl, replaced {include file="today_news.tpl"} with the new file.

This is brute force, but my news items are EXACTLY what I want. Links exactly what I require.

mrkenzie 11-26-2006 04:50 AM

Re: news posting
 
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!

virtualstar 11-26-2006 06:37 PM

Re: news posting
 
Thanks for the replies I like your approach Mike looks like I will have to wait till I upgrade to 4.1. the files you reference either dont exsist on the 4.0 branch or are quite different.

Thanks Again


All times are GMT -8. The time now is 07:35 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.