the_raven Posted June 7, 2013 Share Posted June 7, 2013 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 More sharing options...
vekia Posted June 7, 2013 Share Posted June 7, 2013 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 1 Link to comment Share on other sites More sharing options...
the_raven Posted June 7, 2013 Author Share Posted June 7, 2013 (edited) 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 June 7, 2013 by the_raven (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted June 7, 2013 Share Posted June 7, 2013 you cant use {php} {/php} tags anymore. In smarty it isn't possible now. You can do it with smarty, just use {if strlen($cms->content) < 250} BUTTON READ MORE HERE {/if} 1 Link to comment Share on other sites More sharing options...
the_raven Posted June 7, 2013 Author Share Posted June 7, 2013 thank you super hero.my problem is solved. is there a complete CMS tools for prestashop ? for example cms with comment,share buttoms and many more ? Link to comment Share on other sites More sharing options...
benjamin utterback Posted June 7, 2013 Share Posted June 7, 2013 Hi the_raven, take a look at this module. It has high ratings and a facebook connect. I think it's close to what you are looking for. http://addons.prestashop.com/en/content-management/1213-blog.html 1 Link to comment Share on other sites More sharing options...
nicewikdesign Posted February 11, 2014 Share Posted February 11, 2014 In witch file add : {if strlen($cms->content) < 250} BUTTON READ MORE HERE {/if} ? Link to comment Share on other sites More sharing options...
vekia Posted February 11, 2014 Share Posted February 11, 2014 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 More sharing options...
nicewikdesign Posted February 11, 2014 Share Posted February 11, 2014 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 More sharing options...
vekia Posted February 11, 2014 Share Posted February 11, 2014 ok but text: BUTTON READ MORE HERE appears on homepage? Link to comment Share on other sites More sharing options...
nicewikdesign Posted February 12, 2014 Share Posted February 12, 2014 ok but text: appears on homepage? appers when i change : $cmsongome - $cms {$cmsonhome->content|truncate:750:'......'} {if strlen($cms->content) < 750} originally in tpl is $cmsonhome Link to comment Share on other sites More sharing options...
vekia Posted February 12, 2014 Share Posted February 12, 2014 im lost now, $cms variable doesnt exist on homepage,only $cmsonhome Link to comment Share on other sites More sharing options...
nicewikdesign Posted February 12, 2014 Share Posted February 12, 2014 (edited) 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 February 12, 2014 by nicewikdesign (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts