23.01.2010 6:44, Stéphane пишет:
http://www.symfony-project.org/book/1_0/07-Inside-the-View-Layer
"

Listing 7-8 - The Action Defines a Variable, in
mymodule/actions/actions.class.php

class mymoduleActions extends sfActions
{
   public function executeIndex()
   {
     $this->total = 100;
   }
}

Listing 7-9 - The Template Passes the Variable to the Partial, in
mymodule/templates/indexSuccess.php

<p>Hello, world!</p>
<?php include_partial('mypartial',
array('mytotal' =>  $total)
) ?>

Listing 7-10 - The Partial Can Now Use the Variable, in
mymodule/templates/_mypartial.php

<p>Total:<?php echo $mytotal ?></p>

"

So in the template indexSuccess.php, instead of writing what is written, you
should write :
"<p>Total:<?php echo $total ?></p>"

You'll notice that $total isn't defined as object property in the class
statement.

If you have Php with xdebug configured and a good Php IDE, you'll breakpoint
at mymoduleActions::executeIndex() object method so you'll see in $this
variable (instanceof mymoduleActions) a varHolder property which will hold
your $total variable.

On Sat, Jan 23, 2010 at 1:38 AM, Volkov "BabyWolf" Semjon<
[email protected]>  wrote:

23.01.2010 6:29, Stéphane пишет:


  "Dynamic variables", those which aren't declared as action's object
properties in the class statement, are put in a variable holder by using
magic methods. View get those vars by giving to it the varHolder (which
contains dynamic vars).

Properties defined as object property in the class statement (class
myClass{public $myVar //<- this is a statement defining an object
property}//<- this is a statement defining a class), those aren't
available
in the view as variables.


I knew, I knew it!
Specify how to display the template variables.
Make new dynamic variables for each object property? Or otherwise?
Give me a link to the documentation please.

Many thanks.
I use Netbeans 6.8 and xdebug too.
With partial it works.

--
Не пью; не курю; женщинами интересуюсь, но редко.

--
You received this message because you are subscribed to the Google Groups "symfony 
users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

<<attachment: Volkov_BabyWolf_Semjon.vcf>>

Reply via email to