Previous Thread
Next Thread
Print Thread
Hop To
Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
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?



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
Joined: May 2010
Posts: 28
Sorry, I guess this should have gone under the 'How Do I?' forum



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
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...


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
In scripts/portal.inc.php Find:
Code
			"body" => $body,

Replace With:
Code
			"body" => substr($body, 0, 200),

Replace 200 with however long you'd like it to be.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
Joined: May 2010
Posts: 28
Thanks Gizmo, working a treat smile

However, how do I append a 'Read more' link ?



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
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}

---



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
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.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
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 smile



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
1 members (Havenofsobriety), 522 guests, and 99 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)