SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict zeeb44's Avatar
    Join Date
    Apr 2011
    Location
    Greenville, SC
    Posts
    202
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick php if question

    I am fairly new to php. Still learning as I go. On my website I have the following code.

    Code PHP:
    <?php if(isset($this->clips['menu'])): ?>    
    <div id="mainmenu"><?php
            echo $this->clips['menu'];
        ?></div><!-- mainmenu -->
        <?php endif; ?>

    I know the statement says if something display the menu, if not its hidden. Hoe can I change the statement to just always show the menu. Can I just delete the word if? Or is there another string of code/word to use instead of if? Thanks
    Personal Portfolio - Zeeb44
    IT Manager for - Family Dental Health

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Presumably you would just use this:

    Code PHP:
    <div id="mainmenu">
        <?php echo $this->clips['menu']; ?>
    </div>

  3. #3
    SitePoint Addict zeeb44's Avatar
    Join Date
    Apr 2011
    Location
    Greenville, SC
    Posts
    202
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's what I tried, and the menu bar shows up. But the links on the menu don't.
    Personal Portfolio - Zeeb44
    IT Manager for - Family Dental Health

  4. #4
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,408
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    If you removed the ISSET check and then the menu div shows up but not any content, then $this->clips['menu'] hasn't been initialised. You need to take a look at your code where that variable should be set, and see what's happening.


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
  •