Results 1 to 3 of 3

Thread: php image display problem

  1. #1
    Frontpage User david4ie's Avatar
    Join Date
    Nov 2006
    Posts
    21
    Post Thanks / Like

    Default php image display problem

    Hey

    I was wondering if anybody knows how to display an image based on the url of a website. I have one website running on two different domain names and I would like the logo to change bases on the url.

    This is what ive got but it doesn't seem to work:
    PHP Code:
    <?php
    $url 
    $_SERVER['HTTP_HOST']
    if ( 
    $url 'www.example.com'
    {
    echo   
    "<a href=\"/\"><img src=\"img/logo.gif\" border=0></a>";
    }
    else if ( 
    $url 'www.example2.com' )
    {
    echo 
    "<a href=\"/\"><img src=\"img/logo2.gif\" border=0></a>";
    }
    ?>
    Thanks

  2. #2
    Hosting Caretaker niall's Avatar
    Join Date
    Jan 2007
    Location
    Carlow
    Posts
    87
    Post Thanks / Like

    Default

    Quote Originally Posted by david4ie View Post
    PHP Code:
    <?php
    if ( $url 'www.example.com'
    ?>
    = on it's own isn't a comparison operator. You need ==

    This is the one that has bitten everyone on the ass at some stage.

  3. #3
    Senior Member louie's Avatar
    Join Date
    Jan 2006
    Location
    Dublin, Ireland
    Posts
    2,423
    Post Thanks / Like

    Default

    First you shouldn't do that for SEO purposes, duplicate content but anyhow there is something I use to do in the past.
    saved images (logo) as domain.ie and domain.com then used php to set the path.
    PHP Code:
    <img src='images/".str_replace("www.","",$_SERVER['HTTP_HOST']).".gif' alt='' /> 
    :. Web Design & Development Web Design Ireland
    :. Search Engines Optimization Search Engines Optimization
    :. Car Parts & Accessories Car Parts
    :. Cars Ireland Cars Ireland
    :. I Have 2 Find It Directory SEF Directory

Similar Threads

  1. Google Images - Display Method - How is it done?
    By davidbehan in forum Coding Help
    Replies: 10
    Last Post: 12-01-2007, 04:09 PM

Visitors found this page by searching for:

image display problem php

php image display problem

display based on url php

php image display

facebook like farklı image problem

display php image from url

problem image display php

php image problem

display php image on forum

php display image problem

Tags for this Thread

Posting Permissions

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