Jump to content

Recommended Posts

hi friend's

 

i have a module that shows cms content in home page on Home HOOK

 

this module is created and Developed by MyPresta.eu

 

it has a tpl file with this content :

 

{$cms->meta_title}

{$cms->content}

 

 

now i want to set string limit for cms content on home and define when for example total string chars is "200" it shows the rest of the string by "..." and show a readmore to give users main cms link.. (like other content managment systems)

 

i try to use php for this function in TPL file but it seems php doesn't work for me!

 

appreciate anyone help me about that.. i strongly need it

 

it can be a good free module for evryone that need to have cms contents on home page, if we complete it together.

 

thank you all.

Link to comment
Share on other sites

hi friend's

 

i have a module that shows cms content in home page on Home HOOK

 

this module is created and Developed by MyPresta.eu

 

it has a tpl file with this content :

 

{$cms->meta_title}

{$cms->content}

 

 

now i want to set string limit for cms content on home and define when for example total string chars is "200" it shows the rest of the string by "..." and show a readmore to give users main cms link.. (like other content managment systems)

 

i try to use php for this function in TPL file but it seems php doesn't work for me!

 

appreciate anyone help me about that.. i strongly need it

 

it can be a good free module for evryone that need to have cms contents on home page, if we complete it together.

 

thank you all.

 

hello :-)

 

here I am ;)

 

use something like:

 

{$cms->content|truncate:250:'...'}

 

where the 250 is number of first chars you want to display from content.

 

and add link to the page somewhere below :)

  • Like 1
Link to comment
Share on other sites

great its working,many thanks dear vekia

 

i have other question's .i try to do it myself but i cant , please handle this too me.

 

i want to show "readmore" link if only the total chars is more than '250'.

 

and why i cant use php codes in Module TPL file ? i used this structures :

<?php

//your php code here

?>

and

{php} {/php}

but none of them doesnt execute the php codes.

 

appreciate helping me dear vekia

Edited by the_raven (see edit history)
Link to comment
Share on other sites

  • 8 months later...

In witch file add : {if strlen($cms->content) < 250} BUTTON READ MORE HERE {/if}  ?

 

let's clarify, 

what you've got now? you installed module ?

also truncated length of contents?

if so, you have to paste this to module .tpl file (cmshomepage.tpl)

Link to comment
Share on other sites

let's clarify, 

what you've got now? you installed module ?

also truncated length of contents?

if so, you have to paste this to module .tpl file (cmshomepage.tpl)

 

Yes my .tpl file :

{$cmsonhome->content|truncate:750:'...'}

{if strlen($cmsonhome->content) < 750} BUTTON READ MORE HERE {/if}

 

truncate works but button dosent.

Link to comment
Share on other sites

im lost now,

$cms variable doesnt exist on homepage,only $cmsonhome

normally at .tpl variable is $cmsonhome. 

But if I edit .tpl file :

{$cmsonhome->content|truncate:750:'...'}

{if strlen($cmsonhome->content) < 750} BUTTON READ MORE HERE {/if}

Nothing happened besides turncate.

 

If I write

{$cmsonhome->content|truncate:750:'...'}

{if strlen($cms->content) < 750} BUTTON READ MORE HERE {/if}

 

Works turncate and shows BUTTON READ MORE HERE

Edited by nicewikdesign (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...