John
John

Reputation: 836

How to get partial from another app?

how to getPartial() from another app, I need partial in back-end app from front-end app ? I tried to search answer but I did not have success

Upvotes: 1

Views: 1300

Answers (1)

meijuh
meijuh

Reputation: 1077

You can either create a plugin for this. Or switch the context.

For the latter you can try:

    sfContext::switchTo('name-of-other-app');        
    $this->getContext()->getConfiguration()->loadHelpers('Partial');        
    get_partial('app/module');        
    // dont forget to switch back!
    sfContext::switchTo('name-of-current-app');

If you are working in a Controller you can of course use methods like $this->getPartial().

But creating your own plugin is imho a better solution.

Note that switching context will give you a warning about a session already being started. Fabien refused to fix this when still working on Symonfy 1.4.

Upvotes: 3

Related Questions