Welcome Guest, Not a member yet? Register   Sign In
Insert HTML (navigation menu) into jQuery template
#1

[eluser]KacperK[/eluser]
Hi guys,

I hope someone can help me on this one.

In code igniter 2 I use a template with a certain content view. This works very nice but now I would like to 'insert' some HTML (a navigation menu) into this template ($navigation variable) besides the content view ($content variable). The idea behind this is that I want to create a custom navigation menu everytime someone loads the template (by NTLM). I made some small modifications to the load function of the Template class so I can load the template like this:

$this->template->load('home'); //home.php is the content view

My modified load function in the Template class now looks like this:

function load($view = '' , $view_data = array(), $return = FALSE){
$this->CI =& get_instance();
$this->set('navigation',enum_secured(), TRUE); //should set the navigation HTML in the $navigation variable
template = config_item('template'); //the template in defined in the config file
$this->set('contents', $this->CI->load->view($view, $view_data, TRUE));
return $this->CI->load->view($template, $this->template_data, $return);
}

And last but not least, my template view looks like this:

<cannot post because of notifications that the view contains links>

The problem is that the HTML string that the function enum_secured() returns and should be inserted in the $navigation variable of the Template gets inserted on top of the page and not in the same place as the $navigation variable.

enum_secured() returns a string like this:

<li>
<a href="#" class="nav-top-item no-submenu" id="">
Dashboard
</a>
</li>

I Hope someone can help me with this Smile

Thanks in advance!


Kacper
#2

[eluser]KacperK[/eluser]
Fixed!

The enum_secured() did an echo instead of a return Smile




Theme © iAndrew 2016 - Forum software by © MyBB