0
votes

I've been working on a personal cms project for quite a long time, reason being i was tired to create new db layers and components from scratch for every project.So i decided to start a small cms in zend framework.

Now i get to a point where i should enable users(future clients) to manage the site creating their menus, routes etc and point it to a real page stored in the database.

i have couple of modules like articles, content , gallery etc.in my project i made a separation between article and page.for the article it's quite straight forward i think.for page it can be tricky.

So a page is saved in a table (with html tags) and injected in a view.Since there are routes involed i started being confused about how to link menus created with Zend_Navigation and actual page in the database. for example menu like:

about us           products           contact us
the team           productname 1      local
mission statement  productname 2      international

with different routes like

/about-us          /products/list            /contact-us
/about-us/team     /products/productname1    /contact-us/local
/about-us/mission  /products/productname2    /contact-us/international

Keeping in mind that all the pages are from a single table and rendered through a single view of PageController?

where are concrete questions:

Question 1 Can this approach work at all?
Question 1.1 if not what are better design out there?
Question 2 where is the Zend_Navigation saved? since there should be a interface for users to modify routes and menus.
Question 2.1 Is it ok to use Zend_Config_Xml_Writer?
Question 2.2 if yes is it the best practice?

1

1 Answers

1
votes

From my experience, decoupling your navigation and pages/articles etc is often far simpler for end-users to understand and manage.

While you could build a more complex system that interfaces with zend_navigation, saves to a config file etc, this would add a layer of complexity that is probably unneeded, when you could model your navigation in a separate table - i.e tree pattern, one row per item - set text, title, route, target window etc

CMS wise, you can then provide controls to 'help' users find the routes for your pages, products etc.

This can then be rendered with a view helper or common partial by your application - converting your data into a zend_navigation object if needed at this point.

TLDR; summary:

Use zend_navigation at the application level for presentation purposes, not for modeling your data.

I know