6

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?

Levon Mirzoyan
  • 461
  • 1
  • 2
  • 6

3 Answers3

6

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
  • 11,370
  • 2
  • 40
  • 39
0

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
  • 30,090
  • 27
  • 90
  • 124
0

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
  • 1