1
playsome
Use smarty to strip characters from string? MySearch module
  • 2011/8/3 1:18

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hello all,

I am doing some template modifications to the mysearch module to get it looking like goolge search results.

I can show the url of the result underneat the clickable title (like google) by using this smarty variables

<{$search_results[$sort_key].results[cur_result].link}>


This shows like:
Some page title or article
http://www.mysite.com/modules/news/article.php?id=12

What I want to do is remove the http:// from the unlickable url shown underneat the page title, I have tried

<{$search_results[$sort_key].results[cur_result].link|strip:"http://"}>


But it does not seem to remove the http:// part, anyone got any ideas how to remove those chars without hacking php code?

Cheers

2
zyspec
Re: Use smarty to strip characters from string? MySearch module
  • 2011/8/3 2:25

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


I think you want to use the replace function, not strip. strip just removes excess white space. See http://www.smarty.net/docsv2/en/language.modifier.replace.tpl for more info.

3
playsome
Re: Use smarty to strip characters from string? MySearch module
  • 2011/8/3 9:00

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Thanks very much zyspec, the replace modifier worked perfectly.

Cheers

Login

Who's Online

361 user(s) are online (224 user(s) are browsing Support Forums)


Members: 0


Guests: 361


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