Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14115

Checking if isset is correct?

$
0
0
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 }?>

Viewing all articles
Browse latest Browse all 14115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>