|
Joined: May 2010
Posts: 28
newbie
|
newbie
Joined: May 2010
Posts: 28 |
Hi, See my forum here http://www.saints247.com using the portal as the home. On that home page how can I only show a snippet of text from each post rather than the whole post, say, the first 200 or so characters with a 'read more' link at the end of it?
|
|
|
|
Joined: May 2010
Posts: 28
newbie
|
newbie
Joined: May 2010
Posts: 28 |
Sorry, I guess this should have gone under the 'How Do I?' forum
|
|
|
|
Joined: Jun 2006
Posts: 16,292 Likes: 116
|
Joined: Jun 2006
Posts: 16,292 Likes: 116 |
You'd have to modify the portal files (which really would be unsupported); give me a minute to figure it out...
|
|
|
|
Joined: Jun 2006
Posts: 16,292 Likes: 116
|
Joined: Jun 2006
Posts: 16,292 Likes: 116 |
In scripts/portal.inc.php Find: Replace With: "body" => substr($body, 0, 200), Replace 200 with however long you'd like it to be.
|
|
|
|
Joined: May 2010
Posts: 28
newbie
|
newbie
Joined: May 2010
Posts: 28 |
Thanks Gizmo, working a treat However, how do I append a 'Read more' link ?
|
|
|
|
Joined: May 2010
Posts: 28
newbie
|
newbie
Joined: May 2010
Posts: 28 |
In the portal.tpl file there is code that relates to truncated news, see below, with text of 'To be continued?' but I don't see how this is working or should be working on the page and was wondering if that is how I can get the 'Read more' link I was after?
--- {section name=item loop=$news} {$tbopen} <tr><td class="tdheader"> <span style="float:right" class="small">{$news[item].time}</span> <a href="{ubb url="ubb=showflat&Number=`$news[item].topic_id`" title=$news[item].subject}">{$news[item].subject}</a> <span class="small"> {$lang.POSTED_BY} {$news[item].poster} </span> </td></tr> <tr> <td class="alt-1"> <div class="post_inner"> {if $news[item].newsicon} <img style="float:left; margin: 0px;" src="{$config.BASE_URL}/images/{$style_array.news}/{$news[item].newsicon}" alt="" /> {/if} <br /> {$news[item].body} {if $news[item].truncated} <a href="{ubb url="ubb=showflat&Number=`$news[item].topic_id`" title=$news[item].subject}">To be continued?</a>{/if} <br /><br /> <div style="text-align:right; clear:both" class="small"> {$news[item].views} {$lang.VIEWS} · <a href="{ubb url="ubb=showflat&Number=`$news[item].topic_id`" title=$news[item].subject}">{$news[item].replies} {$lang.REPLIES}</a> </div> </div> </td></tr> {$tbclose} {/section}
---
|
|
|
|
Joined: Jun 2006
Posts: 16,292 Likes: 116
|
Joined: Jun 2006
Posts: 16,292 Likes: 116 |
I noticed that but saw no real indication of how to truncate the data in the cp and didn't really dig in the script file much...
You could just add a link by copying that link data for the truncated message and put it after the {$news[item].body} indication.
|
|
|
|
Joined: May 2010
Posts: 28
newbie
|
newbie
Joined: May 2010
Posts: 28 |
Ok, all I needed to do in the end was replace this bit: {$news[item].body} {if $news[item].truncated} <a href="{ubb url="ubb=showflat&Number=`$news[item].topic_id`" title=$news[item].subject}">To be continued?</a>{/if} with this {$news[item].body}.... <a href="{ubb url="ubb=showflat&Number=`$news[item].topic_id`" title=$news[item].subject}">Read more....</a> Thanks for the pointers
|
|
|
1 members (Havenofsobriety),
522
guests, and
99
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
|
|