Simple hack to template for limiting the story length

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 07-12-2009, 10:05 AM
Casual Pligger
 
Join Date: Mar 2008
Posts: 58
In "Submit" configuration, there are options to define the maximum length of "Story" and "Summary".

Summary maximum length is indeed a control for display and applies to all past stories too; but Story maximum length only applies to the future stories.

Is it possible to hack the template (any one) to display a limited length of the Story, regardless of how long is the submitted Story?
Reply With Quote
  #2 (permalink)  
Old 07-14-2009, 01:33 PM
cmstheme's Avatar
Donor/Coder
Pligg Version: 9.9
Pligg Template: Squaretle
 
Join Date: Jan 2007
Location: Philippines
Posts: 531
Admin > Configure > Submit > Summary Content Truncate

Is that what you're looking for?
Reply With Quote
  #3 (permalink)  
Old 07-14-2009, 01:40 PM
Yankidank's Avatar
Pligg Founder/Coder/Designer
Pligg Version: SVN
Pligg Template: Wistie
 
Join Date: Dec 2005
Location: Ocala, FL
Posts: 4,934
Send a message via AIM to Yankidank
cmstheme: To my knowledge that won't change the number of characters on existing stories, only future submissions.

The Twitter Module for Pligg CMS!
Register, Login, and Submit Stories with Twitter. An absolute MUST HAVE for all Pligg sites!
Reply With Quote
  #4 (permalink)  
Old 07-14-2009, 02:28 PM
cmstheme's Avatar
Donor/Coder
Pligg Version: 9.9
Pligg Template: Squaretle
 
Join Date: Jan 2007
Location: Philippines
Posts: 531
Ahh I misunderstood him.

Anyway, in your link_summary.tpl, find:
Code:
{$story_content}
and replace with:
Code:
{php}
	$the_content= $this->get_template_vars('story_content');
	echo substr($the_content, 0, 300);
{/php}
Change 300 to your desired number of characters.

@Yankidank
Why can't we use the truncate modifier, i.e. {$story_content|truncate} but can use the urlencode and some other modifiers?
Reply With Quote
  #5 (permalink)  
Old 07-14-2009, 03:24 PM
Casual Pligger
 
Join Date: Mar 2008
Posts: 58
cmstheme,

You are WONDERFUL

thanks a million!
Reply With Quote
  #6 (permalink)  
Old 07-24-2009, 09:55 AM
cmstheme's Avatar
Donor/Coder
Pligg Version: 9.9
Pligg Template: Squaretle
 
Join Date: Jan 2007
Location: Philippines
Posts: 531
UPDATE:
Here's an easy way to do it and doesn't require the PHP tags.

Replace:
Code:
{$story_content}
with:
Code:
{$story_content|substr:0:300}
Change 300 to your desired number of characters.
Reply With Quote
  #7 (permalink)  
Old 12-17-2009, 12:35 AM
Constant Pligger
Pligg Version: 1.0.3
Pligg Template: tarthemia
 
Join Date: Mar 2009
Posts: 202
but its shorten the content on full story page also .....can any one help me how to shorten the summary content only in the index page?........
Reply With Quote
  #8 (permalink)  
Old 12-17-2009, 12:47 AM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Social Pro Kit
 
Join Date: Jun 2006
Posts: 5,448
Quote:
Originally Posted by kevin4uguys View Post
but its shorten the content on full story page also .....can any one help me how to shorten the summary content only in the index page?........

Go to admin> configure> submit>

Maximum Summary Length
Description: Maximum number of characters for the story summary.
Value: 400
Default Value: 400
Default Value: number
Reply With Quote
  #9 (permalink)  
Old 12-17-2009, 12:52 AM
Constant Pligger
Pligg Version: 1.0.3
Pligg Template: tarthemia
 
Join Date: Mar 2009
Posts: 202
i have tried that but it doesnt help me ... i think we need to to edit the file link_summary.tpl but i dont knw what to edit there..can any one help me?
Reply With Quote
  #10 (permalink)  
Old 12-17-2009, 12:58 AM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Social Pro Kit
 
Join Date: Jun 2006
Posts: 5,448
Well you can do like what cmstheme mentioned above but add a little to it.
In link_summary.tpl change.

Code:
{$story_content}
Code:
{if $pagename eq "story"}{$story_content}{else}{$story_content|substr:0:300}{/if}
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
New version of Pligg Simple Digg Videos Hack With Thickbox thuggster Questions and Comments 77 02-24-2009 03:53 AM
pligg story char length coolmanphp Questions and Comments 1 01-30-2009 10:05 PM
MacBlue Free Pligg Template by Yankidank Yankidank Free Templates 18 01-20-2009 03:05 PM
Template Files Yankidank Wiki Articles 1 12-06-2008 03:14 PM
How to Hack a Pligg Template Futurosity Questions and Comments 1 03-15-2007 06:30 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development