CodeIgniter Forums
Templated printed twice - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Templated printed twice (/thread-20924.html)



Templated printed twice - El Forum - 07-25-2009

[eluser]Unknown[/eluser]
Hi all, for some reason my template in my project is displayed twice! I've been looking for the bug for a couple of hours now but I'm completely out of ideas!

I'd really appreciate if someone could have a look at it.

First of all this is what happens: http://www.ojii.ch/cibug.png

Now the more interesting part, code:

My controller: http://pastebin.com/m278a0d8e
My parser lib: http://pastebin.com/m418445e0


View files:

base.php: http://pastebin.com/m2a53c9fd
public/nav.php: http://pastebin.com/m25fb70de
public/main_page.php: http://pastebin.com/m422889c8

I know that's a lot of code but still, my whole page gets that bug and I just don't know why Sad.

Please help a CodeIgniter Newbie!


Templated printed twice - El Forum - 07-25-2009

[eluser]Colin Williams[/eluser]
You are consistently sending $this->parser->parse() a FOURTH parameter of TRUE. It's the THIRD parameter that needs to be TRUE (as in, === TRUE). It looks like you are trying to send a $data array second and another array of data third. You need to combine $data and $this->cond. Actually, in your constructor just do $this->load->vars($this->cond) and then you don't need to pass it to every parse method (unless this is only true for regular views. I'm not super knowledgeable in regards to the Template Parser class).


Templated printed twice - El Forum - 07-26-2009

[eluser]Unknown[/eluser]
Erm I pass 4 arguments because I hacked the parser class to allow 'conditional' template tags which are the third param. That third param isnt' $this->cond all the time either, so I don't think that's the problem.

Anyway I'll try to completely get rid of parser and just use views. CI's template engine isn't really useful anyway.


Templated printed twice - El Forum - 07-26-2009

[eluser]Colin Williams[/eluser]
I think it isnt useful because of your code? Might be where your issue is