SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast Jujubee's Avatar
    Join Date
    Mar 2001
    Location
    Canada
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I develop on my PC (windows) and upload to my host (Linux) when I'm done.

    My problem is paths are different (double backslash vs single slash). So I thought I'd put the path in a variable and change it manually when needed.

    So:

    Code:
    $gfxpath="/db/images/"
    $output = "<img src=\"$gfxpathIMAGE.GIF\">"
    Problem is PHP doesn't figure out where the variable ends (it thinks the variable is $gfxpathIMAGE). Is there any way to force this so the variable is replaced correctly? I can do it via concatenation:

    Code:
    $output = "<img src=\"" . $gfxpath . "IMAGE.GIF\">"
    but it's kinda messy. Is there a way without the concatenation?

  2. #2
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All I can think of off the top of my head is making another var with the whole image's path by using concatenation, and then just have:

    Code:
    <?
    $gfxpath = "blah/foo/bar";
    $imgName= "boo.gif";
    $image = $gfxpath.$imgName;
    ?>
    <body>
    ...blah...blah...
    <img src="<? print $image;?>">
    So basically you could just have a small php statement in your html, instead of vice versa.

    ... what's the world coming to?


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
  •