Dynamic Pictures

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Oliphaunt182
    New Member
    • Nov 2006
    • 1

    Dynamic Pictures

    I'm creating a dynamic webpage and I'm trying to load .gif picture however issues arise when I put part of the file and directory in a saved variable. Here is working code that pulls the image:

    $home = '<img id="'. $result1 .'" src="teams\pit. gif" style="Z-INDEX: 108; LEFT: 842px; POSITION: absolute; TOP: 226px"/>';

    echo $home;

    As you can see the image displays in the absolute position and thus works fine but its not dynamic. Here is what doesn't work:

    $home = '<img id="'. $result1 .'" src="teams\'. $result1 .'.gif" style="Z-INDEX: 108; LEFT: 842px; POSITION: absolute; TOP: 226px"/>';

    echo $home;

    where $result1 is pulled from a database and is "pit"

    I already have a banner on this page that dynamically loads that works fine however this is being stubborn.



    UPDATE Working on the problem I've seemed to have narrowed it down to a problem with the \ followed immediately by the '. part.


    Thanks,
    Oliphaunt
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You mixed up the single and double quote tags. I put all between double quotes and make attribute fields single quoted. That way you can store variables in the string withou concatenation.
    [php]$home = "<img id='$result1' src='teams$resu lt1.gif'
    style='Z-INDEX: 108; LEFT: 842px; POSITION: absolute; TOP: 226px' />";[/php]

    Ronald :cool:

    Comment

    Working...