just started using Zend Framework and I'm wondering what to do with odd classes I have. I'm pretty much wondering about best practise for getting everything setup.
I've just enabled layout and I have the wrapping html head, body, footer etc.
In my previous application I created a bundler script where you pass a list of CSS files and JS scripts in a particular order. If it's in development mode then it'll just loop through the filenames and print them out like:
foreach ($CSS_Scripts as $file) {
echo '<link src="' . $file . '" ref="stylesheet" />';
}
foreach ($JS_Scripts as $file) {
echo '<script type="text/javascript" src="' . $file . '"></script>';
}
If it's development mode then it may print out 10 individual CSS and JS files. If it's in production then it will bundle them up so theres only 1 CSS and 1 JS file.
With this being within templating... I'm not quite sure where the logic is supposed to go. It's logic that should exist on every page so it's inside layout.phtml but where am I meant to put my classes and how am I meant to run them? Do I put them in projectname/library
and run the bundler logic inside Bootstrap.php
then assign them to a view and call a view inside layout.phtml
?
Also... say I want a login form to be available at the top of every page when logged out inside layout.phtml
I'm assuming. I've created the Form Application_Form_Login
but to allow logins I need to have an action within a Controller
? Should I be playing the Login action within the Bootstrap
as well so that its possible to login from every page and I'm not duplicating loginAction
on every page?
But then again theres also Zend_Auth which would provide more flexibility right? Maybe this is initiated inside Bootstrap
and then throughout layout.phtml
and any View I can just do conditionals for if you're logged in?
And for landing pages where you have SEO tags in the URL... I'm guessing its a case of creating a seperate Controller/View per keyword like (just examples)... stack-overflow/ computer-questions/ digital-clocks/ and then the content inside these Views
Thanks... I'm quite confused as its a different way of thinking when everything is seperated :D I'm used to having full control everywhere and doing what I want and where I want but that's lead to spaghetti code -.-