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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-03-2008, 02:00 PM
MiK MiK is offline
Junior Member
 
Join Date: Mar 2008
Location: Ancona, Italy
Posts: 17
Send a message via MSN to MiK
Default How to use Zend_Layout ?

Hello all,
i recently switched from SmartyView to default Zend_View and Zend_Layout components as i found them really interesting and offer the same functionality as smarty does.

Anyway, i have few questions:

1. How could tell Zend_View not to render action views automatically?
I would like to set by hand what page needs to be rendered in a specific point of the layout.

2. How to set values for placeholders (eg. $this->layout()->somevar in the view) from the controller?

Thanks.

Last edited by MiK : 06-03-2008 at 02:04 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-03-2008, 03:31 PM
MiK MiK is offline
Junior Member
 
Join Date: Mar 2008
Location: Ancona, Italy
Posts: 17
Send a message via MSN to MiK
Thumbs up

Ok.. it's official...
Every time i post on the forum an help request, i quickly find the solution in a matter of minutes

Quote:
1. How could tell Zend_View not to render action views automatically?
In the bootstrap i resolved in this way:
PHP Code:
$viewHelper Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewHelper->setNeverRender(true); 
and then in the controllers i can output my arbitrary templates in this way:
PHP Code:
public function indexAction() {
   print 
$this->view->render('/path/to/my/view.phtml');

Quote:
2. How to set values for placeholders (eg. $this->layout()->somevar in the view) from the controller?
This is quite simple. I just added this on my controller (and seems to work without problems):
PHP Code:
public function indexAction() {
   
$this->_helper->layout()->somevar $this->view->render('your/view.phtml');

Hope this helps someone who encounters the same problem....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-05-2008, 08:53 PM
Junior Member
 
Join Date: Jun 2008
Posts: 2
Default loading layouts

I use to have code in my boot strap that looked for layouts in my layouts directory

Zend_Layout::startMvc(array('layoutPath'=>'../application/layouts'));

Now when I try this on RC1 I get cannot redeclare class ........


<?php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1);
date_default_timezone_set('America/Phoenix');

set_include_path('.' . PATH_SEPARATOR . '../library' . PATH_SEPARATOR . './application/default/models/' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Controller/Front.php';

Zend_Loader::registerAutoload(); // autoloads stuff as we make calls

/**
* Setup controller
*/

$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory('../application/default/controllers');
$controller->throwExceptions(true); // should be turned on in development time

Zend_Layout::startMvc(array('layoutPath'=>'../application/layouts'));

// run!


$controller->dispatch();

--------------------------------------------

I get class Zend_Layout not found.


What new code do I need to load layouts?

I have found clues but have been unable to fix my problem.

Thanks in advance,
Sean

Last edited by seank : 06-05-2008 at 09:04 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-05-2008, 09:38 PM
Junior Member
 
Join Date: Jun 2008
Posts: 2
Default

Fixed for some reason when I downloaded Zend Studio for Eclipse it had an old version of ZF.
What is the proper way to update ZF in ZendStudio for Eclipse? It says the variable is reserved.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-25-2008, 10:16 PM
phpoet's Avatar
Junior Member
 
Join Date: Sep 2008
Posts: 10
Default

For stopping Zend_View from auto-rendering, in your controller try this:
$this->_helper->ViewRenderer->setNoRender();

More detail here.
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 10:42 PM.