SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fitting an HTML conditional comment inside a php code. Is not working for me

    I am trying to makes the <h4> tags to appear online if IE 5 comes up..
    But the way it is right now doesn't grab the html comment..

    PHP Code:
    <div id="container4">
      <div class="wrap">    
      <?php  
       $query 
    "SELECT name, price, image moreinfo, id
    FROM rfolders
    WHERE
    id IN ( 1, 2, 3, 4)"


    $result mysql_query($query$connection);
    $i 1;

     while (
    $content mysql_fetch_array($result)) {
      echo 
    "  


        <div class=\"shoeinfo1\">
        <img src=\"images/spacer.gif\" alt=\"spacer\" class=\"spacer2\" />
            <h2 class=\"infohead\">"
    $content['name'] . "</h2>
            <div class=\"pic\"><img class=\"line\" src= '"
    $content['image'] ."' alt=\"picture\" width=\"100%\" height=\"100%\" /></div>

            <h5> Rate:</h5>"
    ?> <!--[if IE 5]<h4><![endif]-->
            
            <?php
            $ratingData 
    Rating::OutputRating($content['name']);
          
          if (
    Error::HasErrors())
          {
            echo 
    Error::ShowErrorMessages();
            
    Error::ClearErrors();
          }
          else
          {
            echo 
    $ratingData;
          }  
    ?>
          <!--[if IE 5]</h4><![endif]-->
            <?php echo"<h3>Prosedimiento:</h3>
            <p>Womens fashion shoes with higher 
            heels generally have pre-made, thin,
            flexible, leather or resin rubber fitted
            soles, made using the bottom pattern
            created from the last. Two shapes of
            sole are made this way, one for a Louis
            heel, and the other for a Knock-on type. </p> 
        <p><a href=\"#\">More</a></p></div>
        
        


        "
    ;
    $i++; 
    }
    if (
    $i && $i == 
    {
      echo 
    "<div class=\"clearer\"></div>";

    }    
    ?></div>
    </div>

  2. #2
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there are no conditionsl statements in HTML

    also, even if it were there, it will do nothing to PHP at all.
    You don't have an idea how PHP works.
    It execues on server side, not in browser. There is no PHP code in browser, only HTML.

  3. #3
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let me be more specific I want the <4> tags to appears only if it is IE5 version, is that possible?

  4. #4
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably yes.
    But I can't believe if there is one alive in the whole world.

    You need $_SERVER['HTTP_USER_AGENT'] variable
    it holds browser's "signature" and it is possible to extract browser's name and version from it

  5. #5
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    As said above, the php is processed no matter if the conditional is taken because it's processed before the conditional is looked at by the browser.

    Quote Originally Posted by Shrapnel_N5 View Post
    there are no conditionsl statements in HTML
    Of course there are.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    <!--[if IE 5]<h4><![endif]--> and <!--[if IE 5]</h4><![endif]-->

    should be

    <!--[if IE 5]><h4><![endif]--> and <!--[if IE 5]></h4><![endif]-->

    You left out two >
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Conditional comments only work in Explorer on Windows, and are thus excellently suited to give special instructions meant only for Explorer on Windows. They are supported from Explorer 5 onwards, and it is even possible to distinguish between 5.0, 5.5 and 6.0.
    Oh I see now
    Never knew that


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
  •