views:

39

answers:

1

I'm new to MVC and Zend Framework and I'm working on a project, mostly on the front end. I'm trying to get a sense of what are best practices.

Currently the footer and header are setup through several scripts, one that is a giant XML file of all the content on the website (I think to make the website international friendly, things are wrapped in i18n tags), one that stores all of the links into an array, one that loops through all of the footer/header links, and some other files that I'm not totally sure what they do but they all eventually spit out a simple ul of footer or header links.

It all seems so convoluted to me, why isn't the header and footer just simple html links in layouts, either a part of the main layout.phtml or as an included footer.phtml?

Simple submit buttons are also used as a long views/ helper script, when I see no reason they couldn't just be simple HTML.

I know business logic is left for models, and views are supposed to be lighter front-end scripts for layout. But specifically for Zend framework and web development, any guidance on what exactly belongs as simple HTML and what should be more complex as a helper php script/model script would be much appreciated.

At least just being able to understand what's best practices for a footer and header would help me get started.

Sorry about the length, thanks again.

+2  A: 

Assuming the whole thing is a layout view script, here are my opnions:

  • There is no correct answer, it really depends on the scope of the project.
  • I typically use a single view script, but depending on complexity shift some of the complex areas to partial view scripts or even view helpers.
  • Iterating over data makes sense; if content comes from an external source, you do not want to hardcode it. Simple output doesn't matter... consider the input (content).
  • Form elements are typically closely related to business logic... It lets the back-end developer control certain aspects of them that aren't design-related.

IMO, this question may be better suited towards the guys that coded what's currently there... ZF is very open ended, and it does not force you to use any specific organization methods. I'd give the view helpers documentation a quick read-over as it may help shed some light upon certain view helpers that are used, as well as others you may want to use.

http://framework.zend.com/manual/en/zend.view.helpers.html

Adrian Schneider