Welcome Guest, Not a member yet? Register   Sign In
A better way/approach for Menu navigation
#1

[eluser]qpixo[/eluser]
I'm building a menu options, having issue in last option, The Anchor method doesn't work as a link popup a new window. Besides, in option 1 and 2, I repeat those codes which is not look great.

Is there a better way or approach to do it, make it cleaner?

In my controller:

Code:
public function loadPage($name, $pageID) {
    $data['title'] = $this->tabPageData;
    $data['tabMenu'] = $this->model->getAllMenuItems();

    if ($name == 'portfolio-1') {
        // load portfolio 1, get the page content (photos) and its name
        $data['tabPageContent'] = $this->model->getPageContentByPageID($pageID);
        $data['pageName'] = $this->model->getPageNameByID($pageID);
    } elseif ($name == 'portfolio-2') {
        $data['tabPageContent'] = $this->model->getPageContentByPageID($pageID);
        $data['pageName'] = $this->model->getPageNameByID($pageID);
    } elseif ($name == 'contact') {
        // load Contact page
        $data['tabContact'] = $this->model->getContactByPageID($pageID);
    } else {
        // load a Blog site
        echo anchor('http://mysite.tumblr.com', 'target=_blank');
    }
    $this->load->view('content', $data);
}




Theme © iAndrew 2016 - Forum software by © MyBB