Jump to content

How to include html on condition of field checked


OllieMackJames
 Share

Recommended Posts

In my template I want to exclude some html based on a field being checked.

The field landingpage is a checkbox field, and if it is checked I want to exclude the html below from showing up, how can I do that?

Thanks!

<?php if $page->landingpage=1; //If the checkbox field landingpage is checked I want to exclude the following html code:
	<!-- Top Navigation Bar -->
  <div class="site-nav">
    <div id="navcontrol" class="logobanner centered original-nav">
      <label for="navtoggle" class="navtoggle"><img src="/site/templates/img/logo.png" width="196" alt="logo" title="Menu Toggle" alt="Menu Toggle"><span class='menu-toggle-text'><?=$menu_title?></span></label>
    </div>
    <input type="checkbox" id="navtoggle"/>
    <div class="top">
      <nav class="original-nav">
        <div id="logoline" class="logobanner logobanner-original centered">
          <a href='/'><img src="/site/templates/img/logo.png" width="<?=intval($config->navLogoWidth)?>" alt="logo" style="max-width:<?=intval($config->navLogoWidth)?>px"></a>
        </div>
        <ul class="menu">
          <!--?= renderNav($page); ?-->
        </ul>
      </nav>
    </div>
</div>

 

Link to comment
Share on other sites

@dragan thanks, but I don't understand yet, I tried the following but then the front end throws errors.

<?php if ($page->landingpage !== 1) echo ([  
	<!-- Top Navigation Bar -->
  <div class="site-nav">
    <div id="navcontrol" class="logobanner centered original-nav">
      <label for="navtoggle" class="navtoggle"><img src="/site/templates/img/logo.png" width="196" alt="logo" title="Menu Toggle" alt="Menu Toggle"><span class='menu-toggle-text'><?=$menu_title?></span></label>
    </div>
    <input type="checkbox" id="navtoggle"/>
    <div class="top">
      <nav class="original-nav">
        <div id="logoline" class="logobanner logobanner-original centered">
          <a href='/'><img src="/site/templates/img/logo.png" width="<?=intval($config->navLogoWidth)?>" alt="logo" style="max-width:<?=intval($config->navLogoWidth)?>px"></a>
        </div>
        <ul class="menu">
          <!--?= renderNav($page); ?-->
        </ul>
      </nav>
    </div>
  </div>
]);

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...