加载 - >根据SQL字段查看文件

I'm trying to load a file (a website header) depending on a preference set by a user, which is stored in a mysql db field.

This code loads the header when placed on any page:

<?php $this->load->view('header');?>

Users have an option to select/deselect the header in the preferences. to show the header the term 'show' is saved to the cell in the database and 'hide' to hide.

I have been working this code:

<?php if(($boardDetails->showheader)):show ?>
<?php $this->load->view('header');?>
<?php endif ?>

Where 'showheader' is the database field name and 'show' is the content within it. But I keep getting errors with conflicting php code in the same file: unexpected end etc. When I trim them up to make it viewable the header is loaded regardless of the content of the users field. So 'show' and 'hide' both display the header.

Does anyone have a simpler way of selecting this option working with my current code?

Your should try something like this:

    <?php 
         if(($boardDetails->showheader)=="show"){
          $this->load->view('header');
          } 

    ?>