Extends Issue

4 views
Skip to first unread message

pea

unread,
Aug 7, 2009, 8:13:08 AM8/7/09
to H2o template PHP
Hello, I'm not used to OOS so am probably just being slow. I can't get
extends to work. I have layout.html and archive.php. layout.html is
used as the base template. It's outputting layout.html without the
content block and then again with the content block. I'm not sure
what's going on. I've pastebinned all my code:

archive.php: http://pastebin.com/m31a7acc5
archive.html: http://pastebin.com/m45c72d83
layout.html: http://pastebin.com/m41dfcb6e
output: http://pastebin.com/m4044c489

I understand that this is opensource and would be very grateful for
any support.

Taylor luk

unread,
Aug 7, 2009, 8:59:05 AM8/7/09
to H2o template PHP
Hello pea,


The problem is you are using h2o render method to pass and set the
current context, so in your code the template gets rendered twice.
Which is incorrect usage of the system. $h2o->render() should be
called once and you can pass in the entire context object in one go
with php compact function.


For example:

$name = 'taylor';
$age = 19;
$school = 'The collage';

$h2o->render(compact('name', 'age', 'school'));


I have edited your main script and you can see in this code paste

http://gist.github.com/163882

pea

unread,
Aug 7, 2009, 10:30:02 AM8/7/09
to H2o template PHP
I get the same result.

pea

unread,
Aug 8, 2009, 3:44:35 PM8/8/09
to H2o template PHP
hello?
Reply all
Reply to author
Forward
0 new messages