Results 1 to 4 of 4

Thread: Explain how to use tpl to do a str_replace

  1. #1
    Join Date
    Apr 2003
    Location
    NY
    Posts
    331

    Default Explain how to use tpl to do a str_replace

    i have some old code from 3.2 i need to work with 5.0.1, i have not quite figured out smarty yet, hope i can get some help with getting this to work.

    this would show up in the detail page.

    Code:
    if($b_cd) $line = str_replace("<%$b_cd%>","<a href='<%$b_cd_url%>' ><img src=\"http://www. mydomain.com/images/b_cds.gif\" border='0'></a>",$line);
    		else $b_cd= "<img src=\"http://mydomain.com/images/transparent1.gif\">";
         if($b_mp3) $line = str_replace("<%$b_mp3%>","<a href='<%$b_mp3_url%>' ><img src=\"http://www. mydomain.com/images/b_mp3.gif\" border='0'></a>",$line);
    		else $b_mp3= "<img src=\"http://mydomain.com/images/transparent1.gif\">";

  2. #2
    Join Date
    Apr 2003
    Location
    NY
    Posts
    331

    Default dody help please

    bump!

  3. #3
    Join Date
    Aug 2002
    Location
    Germany
    Posts
    1,180

    Default ?

    You are not alone with your problems

    No idea how your code was working in 3.x templates and what why you went this way, but on questions with IF and ELSE smarty documentation is very easy.

    I think a simple {if $b_cd} output {/if} could do the job ?

    Means if variable exist and has data show the following code.

    Regards
    Frank

  4. #4
    Join Date
    Apr 2003
    Location
    NY
    Posts
    331

    Default

    thanks frank, i have to get use to smarty, it was a lot easer then i thought.

Similar Threads

  1. str_replace $url
    By bdewijs in forum Blocks and Modification
    Replies: 17
    Last Post: 06-07-2006, 03:53 AM
  2. str_replace to show image help
    By persut in forum v5.x
    Replies: 2
    Last Post: 01-14-2006, 07:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •