Welcome Guest, Not a member yet? Register   Sign In
[Thanks All For Advice] Checking if isset is correct?
#1

(This post was last modified: 09-11-2016, 04:46 PM by wolfgang1983.)

Question: On my view file default.php I would like to know if I have set the isset correct? It's just a new way of loading views that I am trying

On my controllers I load views like

Login.php

PHP Code:
public function index() 
{
    
    $this
->data['views'][] = array(
        'header' => 'common/header',
        'footer' => 'common/footer',
        'content' => 'common/login'
    );

    $this->load->view('common/default'$this->data);


Dashboard.php

PHP Code:
public function index() 
{
    
    $this
->data['views'][] = array(
        'header' => 'common/header',
        'footer' => 'common/footer',
        'navbar' => 'common/navbar'
        'content' => 'common/dashboard'
    );

    $this->load->view('common/default'$this->data);


How ever if the navbar does not exist on my login views array but does on dashboard views array

On my view default.php I would like to know what is the better way of setting isset


PHP Code:
<?php foreach ($views as $view) {?>
    
    <?php $this->load->view($view['header']);?>
    
    <?php isset($view['navbar']) ? $this->load->view($view['navbar'])  '';?>
    
    <div class="container">

        <?php $this->load->view($view['content']);?>

    </div>

    <?php $this->load->view($view['footer']);?>

<?php }?>
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
[Thanks All For Advice] Checking if isset is correct? - by wolfgang1983 - 09-09-2016, 03:32 AM
RE: Checking if isset is correct? - by JayAdra - 09-09-2016, 04:39 AM
RE: Checking if isset is correct? - by InsiteFX - 09-09-2016, 04:55 AM
RE: Checking if isset is correct? - by PaulD - 09-10-2016, 11:50 AM
RE: Checking if isset is correct? - by Wouter60 - 09-11-2016, 10:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB