开发者

Symfony question. How to use get_partial inside the action.class?

When I do this:

public function executeGetHTML(sfWebRequest $request)
{
  **$pageContent = get_partial('mypage2'); **
}

I get this:

Call to undefined function get_partial()

so, how to switch it on? I tried sfLoader::开发者_JAVA技巧loadHelpers('Partial'); but it says sfLoader is undefined.. :(


You need to use $this->getPartial() in your actions.


Above answers didn't work for me

I've tried:

sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
$html = get_partial('partial_name');

And it works.

You have to call get_partial function in action class without $this keyword.


And if it still doesn't work. Check if you have:

all:
 .settings:
  #....
  standard_helpers:       [Partial]

In your config/settings.yml file


Try to load the 'partial' helper.Something like this :

sfContext::getInstance()->getConfiguration()->loadHelpers('Partial);

And then try:

this->get_partial('name of your partial');

Note: Provided check the symfony version.If it is 1.4 , it doesn't invoke partial helpers by default.And so we need to the use the code above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜