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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-22-2008, 09:40 PM
Junior Member
 
Join Date: Apr 2008
Posts: 3
Default Access model from a layout

I need to know how to access a model from a layout registered with the application to display data retrieved from the database.. any example would be great
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-23-2008, 01:56 AM
dele454's Avatar
Member
 
Join Date: Jun 2008
Posts: 46
Default

Quote:
Originally Posted by boodito View Post
I need to know how to access a model from a layout registered with the application to display data retrieved from the database.. any example would be great
Any reason why you would want to access your models directly from your layout or view? Why not create an instance of your model in your controller action. Then send the result of your logic from your action controller to the layout?

Last edited by dele454 : 07-23-2008 at 12:29 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-23-2008, 12:22 PM
Junior Member
 
Join Date: Apr 2008
Posts: 3
Default

yeah, i have a widget that shows on all the pages, so i need to create it in the layout, i created a view helper CommentWidget to retrieve the data and return them formatted, then in the layout i have <?php $this->commentWidget(); ?> that's supposed to render the returned html from the view helper but it's not happening! knowing that the helper path is well set in the bootstrap file
any ideas?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-23-2008, 12:28 PM
dele454's Avatar
Member
 
Join Date: Jun 2008
Posts: 46
Default

Hi

I also have that problem such that when i set my HelperPath to my view helpers ZF for some reason doesnt render the output as expected. Am not sure if it is a path resolving issue - I did everything but nothing worked!!

But when i moved the helpers to the Zend>View>Helper of the Zend component folder they work. - though not ideal this seems to be the only working option for me. So you might be having the problem of path resolves.(adding your helper folder to an include folder to apache also didnt work for me).

Try putting them in that folder and see if it works. Let me know though
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-23-2008, 01:40 PM
Junior Member
 
Join Date: Apr 2008
Posts: 3
Default

It's not the first time I use View Helpers from the library/APPNAME/View/Helper directory in my applications, but this is the first time i try to pull the data to the layout, am not sure where the problem is, I also tried to instantiate the model in the view but I nothing also...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-24-2008, 12:11 PM
lucasm's Avatar
Junior Member
 
Join Date: Mar 2008
Location: Įguas Claras-DF, Brazil
Posts: 17
Lightbulb Zend_Loader and the naming convention

guys,

Make sure the Zend_Loader isn't searching at the wrong place.

If I am right, loader tries to read your file in a path like Boodito said: "library/APPNAME/View/Helper". This happens in classes that uses the Zend's naming convention.

regards,
__________________
Lucas Mauricio C. e Martins
CR Vasco da Gama, my biggest passion!

Ajude a Combater o Spam! - Help fighting spam!
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 09:57 PM.