1
bjuti
How to truncate string?
  • 2010/1/9 17:03

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


Hi Xoopsers...

I'm trying to add some SEO features in Classifieds 2.0RC2, so i've been editing index.php file like this:
$xoopsTpl->assign('desctext'$desctext);
$desctextclean strip_tags($desctext'<font><img><b><i><u>'); 
$xoopsTpl->assign('xoops_pagetitle',"$title $ctitle - $type");
$xoTheme->addMeta('meta''description'"$title $ctitle $type $price $typeprice $desctextclean|truncate:100:''");


All works ok, but I've tried to truncate $desctextclean to 100 chars, with no luck.

Any idea or help? (I'm not a programmer :) )

2
ghia
Re: How to truncate string?
  • 2010/1/9 19:20

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


|truncate:100:
That is a Smarty instruction to be used in templates.
You are dealing with PHP:
$xoTheme->addMeta('meta''description'"$title $ctitle $type $price $typeprice ".substr($desctextclean,0,100) );


3
bjuti
Re: How to truncate string?
  • 2010/1/10 0:00

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


Tnx Ghia :)

Soon I'll post hack for Classifieds in News :)

Login

Username:
Password:

Lost Password? Register now!

Who's Online

74 user(s) are online (50 user(s) are browsing Support Forums)


Members: 1


Guests: 73


heyula,

more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits