How to add </div> by using a include?

Discussion in 'Programming' started by xnarutogodx, Dec 28, 2009.

  1. #1
    Okay I need help doing this
    <?php if it's this /categories/ page then </div> will appear ?>
    Code (markup):
    .Any help with this will be greatly appreciated. The included file has </div>. I need this because I'm using it in two parts of my site and my format will messed up if I just put it. On one but the other will messed up with it.
     
    xnarutogodx, Dec 28, 2009 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    A quick and dirty way :)

    
    <?php
        if($cat = 'some cat or id number') {
            echo '<div>    </div>';
            }
    ?>
    
    PHP:
     
    MyVodaFone, Dec 28, 2009 IP
  3. yoes_san

    yoes_san Peon

    Messages:
    443
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Like MyVodaFone said, but you have to use "==" not "="

    
    if($cat == 'some cat or id number') {
         echo '</div>';
    }
    
    PHP:
     
    yoes_san, Dec 28, 2009 IP
  4. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #4

    opps my bad :)
     
    MyVodaFone, Dec 29, 2009 IP
  5. xnarutogodx

    xnarutogodx Peon

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hey is it possible to do like this I'm kinda new to php and here's what I need to know. The place I need to this is http://website.com/catergories/ and I need to know how to do this?
    if($cat == '/catergories/') {
         echo '</div>';
    }
    PHP:
    Is this right?
     
    xnarutogodx, Dec 29, 2009 IP
  6. dollarfish

    dollarfish Member

    Messages:
    89
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    26
    #6
    It is not clear enough what do you want to do so give more information. I think you should check the path of the current file and then show the div tag.
     
    dollarfish, Dec 29, 2009 IP
  7. xnarutogodx

    xnarutogodx Peon

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Okay a plugin That I have makes categories into images right. And since I have my catergories images link to my each category page I have so it will show the images they both share the code.
        <h3><?php echo $category[ 'name' ]; ?></h3>
        </a></div>
       
    Code (markup):
    When I remove the the </div> then the categories page format works great. But the plugin catergory images format is not working.And the Vice and versa. So I want to know how can I </div> to only that page which is http://site.com/catergories/. Not the category page http://site.com/category/catergoryname/.
    Basically Just put a </div> when every it's in /category/.:D
     
    xnarutogodx, Dec 30, 2009 IP
  8. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #8
    I am sure there's probable a better way, however it should do the trick:

    
    if ($_SERVER['SCRIPT_URI'] == 'http://site.com/catergories/') {
            echo '</div>';
        }
    
    PHP:
    ohh and please note the spelling of categories, I just posted it as you have it 'catergories'
     
    Last edited: Dec 30, 2009
    MyVodaFone, Dec 30, 2009 IP
  9. ProgOn2

    ProgOn2 Guest

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Okay a plugin That I have makes categories into images right. And since I have my catergories images link to my each category page I have so it will show the images they both share the code.
     
    ProgOn2, Dec 31, 2009 IP