SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast jaspervd's Avatar
    Join Date
    Sep 2005
    Location
    Netherlands
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question variable inside img tag, cant get it right

    I have been trying and trying to add some smileys to my shoutbox, but I just cant seem to find out how to do it, here is my code (at least the parts that mather, I think the code speaks for itsself):

    PHP Code:
    $baseurl "http://www.xxx.com/game/";   
    $themename "blabla"
    $smileybaseurl'".$baseurl."plugins/site/themes/".$themename."/';
    $symbols = array('8)'':D');
    $file_names = array('<img src="".$smileybaseurl."/smiley/icon_cool.gif">',
    '<img src="$smileybaseurl/smiley/icon_smile.gif">'
    );
    $msg2str_replace($symbols$file_names$msg1); 
    because of the ' needed for the array and the " needed for the src, how can I add the variable $smileybaseurl inside the src tag?

    (I tried things like ".$smileybaseurl." and using \, but I just cant get it to work

    Thanks in advance!

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you should always look at the html source that your php script produces.
    it will help you see why you are having problems.


    PHP Code:
    '<img src="' $smileybaseurl '/smiley/icon_cool.gif">'
    // or
    "<img src=\"$smileybaseurl/smiley/icon_cool.gif\">" 

  3. #3
    SitePoint Enthusiast jaspervd's Avatar
    Join Date
    Sep 2005
    Location
    Netherlands
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher
    you should always look at the html source that your php script produces.
    it will help you see why you are having problems.


    PHP Code:
    '<img src="' $smileybaseurl '/smiley/icon_cool.gif">'
    // or
    "<img src=\"$smileybaseurl/smiley/icon_cool.gif\">" 
    thanks man, problem solved the first thing worked


Bookmarks

Posting Permissions

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