murvinlai
murvinlai

Reputation: 50375

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::loadHelpers('Partial'); but it says sfLoader is undefined.. :(

Upvotes: 2

Views: 4197

Answers (4)

jbator
jbator

Reputation: 540

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.

Upvotes: 2

Tech Helper
Tech Helper

Reputation: 1

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.

Upvotes: 0

Luis Chanferoni
Luis Chanferoni

Reputation: 336

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

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

In your config/settings.yml file

Upvotes: 0

Maerlyn
Maerlyn

Reputation: 34107

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

Upvotes: 6

Related Questions