Hi There.
I am working on an existing website that uses Zend Framework, and I am trying to avoid hard-coding content that needs to be dynamic in nature.
I have a list of articles that need to be output as links with or without a description. Each link generates a dynamic page that will output the full article with a breadcrumb and a link list of the other article titles, saving state to highlight the current article. I have a template ready to take each variable, but first I need a content source.
Because the list is somewhat short, we do not feel it should be stored in the database (how would I even enter/edit said content in the database without a CMS?).
Can this be done by parsing an XML document, or is there another method I am not thinking of? I've used SimpleXML on non-Zend PHP sites but calling the class directly doesn't seem to work (I think it might be a path issue).
EDIT: I ended up using the solution recommended by prodigitalson:
I created an XML file for my content's meta data (title, hash, description, include file) and put it in my app/modules/default/model folder. I then laid out each full article as an include snippet, and put the files in views/partials. I created a custom class with the methods I needed and put it in my library folder -- then, I instantiated my class in the controller's init() method. Then, the object was available to all pages/actions within that controller.
Then, I can call any method from the controller-instantiated object in a corresponding view. I'm able to output links, full articles and everything else I need by using this approach. I'm passing the current URL param (hash) to the class before outputting the link list in order to highlight the current link.