php - Load->view a file based on SQL field -
i'm trying load file (a website header) depending on preference set user, stored in mysql db field.
this code loads header when placed on page:
<?php $this->load->view('header');?>
users have option select/deselect header in preferences. show header term 'show' saved cell in database , 'hide' hide.
i have been working code:
<?php if(($boarddetails->showheader)):show ?> <?php $this->load->view('header');?> <?php endif ?>
where 'showheader' database field name , 'show' content within it. keep getting errors conflicting php code in same file: unexpected end etc. when trim them make viewable header loaded regardless of content of users field. 'show' , 'hide' both display header.
does have simpler way of selecting option working current code?
your should try this:
<?php if(($boarddetails->showheader)=="show"){ $this->load->view('header'); } ?>
Comments
Post a Comment