In Symfony, the sfDoctrinePager is awesome. To make it more reusable though, I made partial in the app/template/ directory so that I could include in on any page that needed pagination. Of course, that’s when I got an error!
500 | Internal Server Error | sfRenderException
The template “_paginate.php” does not exist or is unreadable in “”.
My assumption was that if symfony was given /paginate
as a name for the partial name, it would get the hint that it was being stored in app/templates/. But that wasn’t the case, because the error persisted. I wasn’t sure if symfony could even do this, but then how could this super powerful framework not support including partials from the main template directory? Impossible.
So I looked up the documentation for the include_partial
function. Well, it wasn’t found. Instead, doing a quick google turned up the PartialHelper instead, which was I was looking for.
It turns out that the include_partial
global as the module name.
If the module name is ‘global’, then the partial file is looked for in myapp/templates/.
So, to include my paginate partial, I called include_partial("global/paginate", array("pager"=>$pager, "url"=>url_for("collection/index"));
. That’s all there is to including a partial in symfony from the app/template folder.
Happy partials.
This is great, Thanks!