#1
I just wanted a pointer on the best way to structure the passing of dynamic data to a partials view file.

I have two partials 'header.php' and footer.php' which are called into Public.php.
i.e. Template::partial('partials/header') which is called within Public.php

Within header.php I have my nav code and I need to pass data to it so I can loop within one of the nav ul's to echo out data from the categories table in my DB.

Should I write the function that gets the data within the controller Templates.php? and then pass it to partials/header as the view file? or create a new Module and create it from there?

Thanks
#2
Hello,

Should I write the function that gets the data within the controller Templates.php? and then pass it to partials/header as the view file? or create a new Module and create it from there?

Depends on keeping track of your functions. If you put it in the Templates folder, when you update it gets written over.
Having a separate module keeps things modular to re-use in other apps.

Two possibilities

Create a module for handling the Nav.
Create a module called my_functions and put your code in there. That way all your code is portable.

Dan