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

news posting

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-11-2006, 11:19 AM
 
cascadegps cascadegps is offline
 

Newbie
  
Join Date: Oct 2005
Posts: 6
 

Default 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?
__________________
-
www.cascadegps.com and marine electronics
X-Cart v4.0.16, Linux
Reply With Quote
  #2  
Old 08-11-2006, 11:41 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 08-11-2006, 12:31 PM
 
cascadegps cascadegps is offline
 

Newbie
  
Join Date: Oct 2005
Posts: 6
 

Default news management

THanks. that worked just fine.
__________________
-
www.cascadegps.com and marine electronics
X-Cart v4.0.16, Linux
Reply With Quote
  #4  
Old 08-11-2006, 08:39 PM
 
jdedba jdedba is offline
 

Advanced Member
  
Join Date: Dec 2004
Posts: 96
 

Default

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.
__________________
version 4.1.1
Reply With Quote
  #5  
Old 08-12-2006, 06:48 AM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default

Nice! I like that...
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
  #6  
Old 11-08-2006, 09:31 AM
 
Josaram Josaram is offline
 

Member
  
Join Date: Jul 2006
Posts: 14
 

Default Re: news posting

thank you as well, I needed help with this and it worked perfect
__________________
Jolyn
X-cart gold 4.1.2
Reply With Quote
  #7  
Old 11-25-2006, 08:57 PM
 
virtualstar virtualstar is offline
 

Newbie
  
Join Date: May 2006
Posts: 9
 

Default 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
__________________
Joshua
X-Cart v4.1.5
Reply With Quote
  #8  
Old 11-25-2006, 09:32 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #9  
Old 11-26-2006, 04:50 AM
 
mrkenzie mrkenzie is offline
 

Senior Member
  
Join Date: May 2006
Posts: 182
 

Default 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!
__________________
Mike Kenzie
X Cart Gold Ver. 4.1.3
X-RMA
X-AOM
X-Product Comparison
Reply With Quote
  #10  
Old 11-26-2006, 06:37 PM
 
virtualstar virtualstar is offline
 

Newbie
  
Join Date: May 2006
Posts: 9
 

Default 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
__________________
Joshua
X-Cart v4.1.5
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 06:19 AM.

   

 
X-Cart forums © 2001-2020