html inside php

Discussion in 'PHP' started by Financiallypoor, Dec 22, 2010.

  1. #1
    How do i get html inside php but only have it on certain wordpress pages.
    I want it to look like this
    
    <?php if ( function_exists( 'get_smooth_slider' ) && !is_page(array(977,1773,514,177,190,231,321,29,1032,1820,2) )) {
      get_smooth_slider(); }
    ?>
    
    Code (markup):
    With the !is_page code. I don't know what to put after the <?php if.
    Thank you for any help
     
    Financiallypoor, Dec 22, 2010 IP
  2. _:codefan:_

    _:codefan:_ Active Member

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #2
    
    <?php 
    
    if ( function_exists( 'get_smooth_slider' ) && !is_page(array(977,1773,514,177,190,231,321,29,1032,1820,2) )) {
    
    ?>
    <strong>HTML CODE</strong>
    
    <?php
      get_smooth_slider(); 
    
    }
    ?>
    
    PHP:
     
    _:codefan:_, Dec 22, 2010 IP
  3. Financiallypoor

    Financiallypoor Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the response. I'll specify a little better.
    How do I make it without the slider

    so like this:
    <?php if ( !is_page(array(977,1773,514,177,190,231,321,29,1032,1820,2) )) {
      html code }
    ?>
    Code (markup):
     
    Financiallypoor, Dec 22, 2010 IP
  4. _:codefan:_

    _:codefan:_ Active Member

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #4
    
    <?php if ( !is_page(array(977,1773,514,177,190,231,321,29,1032,1820,2) )) {
     ?>
    
    HTML
    
    <?php
    
    }
    ?>
    
    PHP:
    or

    
     <?php if ( !is_page(array(977,1773,514,177,190,231,321,29,1032,1820,2) )): ?>
    HTML
    <?php endif; ?>
    
    PHP:
     
    _:codefan:_, Dec 22, 2010 IP
  5. Financiallypoor

    Financiallypoor Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That worked great. Thank you very much
     
    Financiallypoor, Dec 22, 2010 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    or just create a variable in this format

    $test = <<<EOD
    <html>
    </html>
    EOD;
    echo $test
     
    Bohra, Dec 22, 2010 IP
  7. CyberSorcerer

    CyberSorcerer Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If you want to insert HTML inbetween PHP tags use:
    
    <?php if ( !is_page(array(977,1773,514,177,190,231,321,29,1032,1820,2) )) { ?>
    -- HTML_CODE --
    <?php } ?>
    
    PHP:
     
    CyberSorcerer, Dec 22, 2010 IP
  8. naskin

    naskin Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    This is a bad programming style.
     
    naskin, Dec 24, 2010 IP