Welcome Guest, Not a member yet? Register   Sign In
Using PHP code in the Template library configuration file?
#1

[eluser]parham90[/eluser]
Hello,

I have downloaded a library called Template library for CodeIgniter. While it is very good, I want to define a default menu bar for my whole application in the configuration. There's a problem with this, however. The items in the configuration file, apparently, do not get parsed. So if I put PHP code in the configuration file, it will just stay as is, and appear in the final HTML page. I am assuming what I need to do is to find something that runs every time a page is requested, and set the menu there. For example:
Code:
$data['menu') = "<ul>
<li>&lt;?=anchor('users/register', 'register')?&gt;</li>
</ul>
";

Is there a more clean workaround? If not, where do you recommend I put this code?

Thanks!
#2

[eluser]gyo[/eluser]
This is a perfect situation to extend the main Controller using MY_Controller.

Enjoy!
#3

[eluser]danmontgomery[/eluser]
Code:
$data['menu'] = "<ul>
<li>".anchor('users/register', 'register')."</li>
</ul>
";
#4

[eluser]parham90[/eluser]
Hi!

Thanks! I thought even though I am autoloading 'url', it won't get loaded when the configuration files are read. *smiles*

[quote author="noctrum" date="1280444493"]
Code:
$data['menu'] = "<ul>
<li>".anchor('users/register', 'register')."</li>
</ul>
";
[/quote]




Theme © iAndrew 2016 - Forum software by © MyBB