tags:

views:

52

answers:

3

I am currently implementing the navigation of the website (multilevel menu, having current page highlighted). As navigation part will be included for virtually all modules, I first made it a global partial. But logic for selection of "current page" is quite complicated in some situations, I am thinking of using a component for the navigation.

The problem is that symfony allows to have global partials, but not global components. So is there a "nice symfony way" to do this?

+3  A: 

There isn't a mechanism for this as such. I usually end up creating an empty module called default and putting stuff like that in there.

benlumley
you at least should avoid using "global" as module name, it's reserved word for global partials.
Levon Mirzoyan
true, yes. edited.
benlumley
A: 

What's wrong with:

<?php include_component('someModule', 'navigationComponent') ?>

... where you store it in some general module (e.g. "general") and call it wherever you want, including your layouts. Isn't that global enough?

Tom
A: 

This is your solution:

Create the yourproject/yourapp/templates/_globalpartial.php with this content:

<?php include_component('yourmodule', 'yourcomponent'); ?>

And use this globalpartial.php in yourproject/yourapp/templates/layout.php

gBubu