Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-20-2007, 02:46 PM
jap jap is offline
Junior Member
 
Join Date: Apr 2007
Posts: 23
Default Modular Layout (header, body, footer)

Hi,

I'm currently updating my ZF and using a different directory structure that's handier (the multiple controllers system. Like here:
Zend Framework

I'm currently using 2 standar templates that are located in:
application/views/scripts/header.phtml (and footer.phtml)

And my articles index.phtml is located here:
application/article/views/scripts/index.phtml

Now as you'll probably guess, my header.phtml and footer.phtml don't get loaded anymore.
I've got this code:
PHP Code:
<?php echo $this->render('header.phtml'); ?>
some interesting content
<?php echo $this->render('footer.phtml'); ?>
How do I make render() take the footer.phtml file from here: application/views/scripts/header.phtml ?

Sorry for my bad english, it's not my native language.
I've also tried this: Zend Framework

But what is the actual root of that command? :s

Thanks,
Jasper

Last edited by jap : 04-20-2007 at 02:50 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-21-2007, 11:16 PM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 121
Default

do you have the view paths defined?
__________________
Zym Framework - A Zend Framework extension library w/ demo app

SpotSec Blog:
http://spotsec.com/blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-23-2007, 09:43 AM
jap jap is offline
Junior Member
 
Join Date: Apr 2007
Posts: 23
Default

Quote:
Originally Posted by SpotSec View Post
do you have the view paths defined?
Yes, but ZF doesn't "keep it in mind"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-23-2007, 08:35 PM
MikeCoughlin's Avatar
Junior Member
 
Join Date: Apr 2007
Location: Westerly, RI - USA
Posts: 1
Send a message via ICQ to MikeCoughlin Send a message via AIM to MikeCoughlin Send a message via MSN to MikeCoughlin Send a message via Yahoo to MikeCoughlin
Default

As I understand the render function, the intent is to render everything at once to the browser - since, once one sends something to the browser, subsequent sends (e.g. a header or footer) will be ignored by the browser. I think this is the same reason a header section is used in an html file.

Therefore, one would have to gather all the pieces (so to speak) into a single file for rendering - in one shot. Note, the examples seem consistent on this point i.e. they gather everything up, then render() it, once.

In your case, I wonder if render would take an array argument ? ... which would, then, render the array all at once.

I'm new (and confused) by all this, too - especially the approach changes from one Zend Framework (sub)version to the next; so, don't take my words to the bank. <G>

Last edited by MikeCoughlin : 04-23-2007 at 08:42 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-23-2007, 11:13 PM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 121
Default

The code you provided so far looks to me as it should work, but what I am worried about is that you don't have the view paths defined or this is a different instance of the view object.

Does header.phtml or footer.pthml exist on the paths when you do a print_r($view->getScriptPaths());
__________________
Zym Framework - A Zend Framework extension library w/ demo app

SpotSec Blog:
http://spotsec.com/blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-24-2007, 10:30 AM
jap jap is offline
Junior Member
 
Join Date: Apr 2007
Posts: 23
Default

Hmm I think I'm starting to understand the problem here but I unfourtunately i'm not working with the multiple controllers anymore for this project.

But I'm going to test it in my next project, I think the problem came from the fact that I was creating a new instance of View but I can't check that anymore.

Thanks for your support,
Jasper
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:12 PM.