views:

44

answers:

1

I ask because in my Zend Framework app I use some view scrips that do not have an action associated with them. (Similar to the example on page 102 in the Zend Pro Framework Techniques book http://books.google.com/books?id=znA1LgQSxsoC&lpg=PP1&dq=Pro%20Zend%20Framework%20Techniques%3A%20Build%20a%20Full%20CMS%20Project&pg=PP1#v=onepage&q&f=false) and because Zend_Tool does not allow you to create an view inside of a module(as far as I can tell).... it will create a view in side a module only if you use

zf create action name controller-name[=Index] view-included[=1] module

Any thoughts on this would be appreciated.

+3  A: 

Are you creating "partial" view scripts? A partial view script is a view script that helps you reuse code in multiple view scripts. They are commonly named with an underscore to signify that they are a partial view script. It's perfectly acceptable to have a partial view script without a controller action.

/posts/index.phtml
/posts/show.phtml
/posts/_post.phtml

# index.phtml
foreach ($this->posts as $post) {
    echo $this->partial('posts/_post.phtml', array('post'=>$post));
}

# show.phtml
echo $this->partial('posts/_post.phtml', array('post'=>$post));

# _post.phtml
<h1><?php echo $this->post->title ?></h1>
<p><?php echo $this->post->body ?></p>
Andrew
Yes, it is a partial view script.
Fatmuemoo
So what about using tool to create a view script in a module?
Fatmuemoo
I don't use the tool. I create the files manually. I recommend you do the same.
Andrew
the tool is great for scripting standard application structure; it certainly should not be used as an indicator of whether something should or could be done with ZF
jah