Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Member screenweb's Avatar
    Join Date
    May 2003
    Location
    Surrey, UK
    Posts
    89
    Member #
    1452
    Basically i'm trying to work out how I can echo images, if a screen is a certain size or higher:
    PHP Code:
    <?php

      echo 
    "<script language=\"javascript\">\n"
      echo 
    "  location.href=\"${_SERVER['SCRIPT_NAME']}?${_SERVER['QUERY_STRING']}
                
    "&width=\" + screen.width + \"&height=\" + screen.height;\n"
      echo 
    "</script>\n"
      exit(); 

    echo
    "<BR \>";
    echo
    "<BR \>";
    echo
    "<BR \>";
    {

    //It doesn't like the line below!!!
    if ($_GET['width'] >= '1024' && $_GET['height'] >= '768');


    echo
    "<img src=http://www.screenweb.co.uk/images/design_01.jpg>";

    else
    exit();
    }

    ?>
    Any ideas?

  2.  

  3. #2
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    Hey james, long time no see

    Your if statment is not doing anything because of that semi-colon.

    It should be:

    if ($_GET['width'] >= '1024' && $_GET['height'] >= '768')
    echo"<img src=http://www.screenweb.co.uk/images/design_01.jpg>";
    There and Back Again :Ogre:

  4. #3
    Member screenweb's Avatar
    Join Date
    May 2003
    Location
    Surrey, UK
    Posts
    89
    Member #
    1452
    Thanks alot - Yes I haven't been around on here much, too busy on WHT :rambo:

  5. #4
    Senior Member Brak's Avatar
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    3,413
    Member #
    1217
    Liked
    2 times
    Also get rid of the single quotes around the numbers (although, nsr81 is right, it's the semi-colon that's doing it to you) because that means it's interpreting it as a string (well... maybe considering PHP is pretty smart) and you can never realy tell what a string is going to compare to...
    Kyle Neath: Rockstar extraordinare
    The blog | The poetry site | The Spore site

  6. #5
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    yeah, missed that bit. sorry about that
    There and Back Again :Ogre:

  7. #6
    Member screenweb's Avatar
    Join Date
    May 2003
    Location
    Surrey, UK
    Posts
    89
    Member #
    1452
    Works fine now, the ' ' don't appear to make any difference.

    My first website designed to change with the screen resolution is under way.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:38 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com