I'm new to ZF, and am still learning. As I learn I am trying to do what best fits for my situation, so I was hoping I could get some folks with experience to look this plan over and let me know if I'm on track, or can offer advice.
The site I am working on will have many many pages. There will be a small handful of templates and module blocks that will get dynamic data, depending on the page.
Each page is registered in our admin and given what the URI is to be for the page. Then the sections of the site that are to be dynamic are attached the ID of the page it is needed for. These are anything from ads to displaying rate data and so on. We will not be passing variables in our URLs. Instead we use the URI of the page to get the page_id from the database, then use that ID for most everything else. So the key here is to not have numerous controllers or actions, unless the page required it. For the most part, however, we would create a new template for any unique situation that would require a page to be outside the normal templates. So routing is key, and most important regarding routing is that the route uses the same controller/action from the get-go.
Below I explain what my controller/action and model do. I would like advice in this. I have no other Zend folks to ask, and my Zend experience is NOOB. Please provide links to any sites that might help explain any of your opinions or direction. Keep in mind that the number of pages on the site will be too numerous to create a controller for each, and the idea is to have templates so pages can be created by non developers.
Thanks in advance for all your help.
The following describes the process of building a page using the same controller, action and model. It is called when there is no controller found by matching the URI. This would be the case for the majority of pages on the website.
Default Controller name: DefaultController
Default action name: defaultAction - Passes the URI string ( $page_uri )
Purpose: To determine which template to use, and to pass the data found in the model to the template for its use to complete the template build.
If the returned value from DefaultModel::getPageInitData() is FALSE, the 404 template is called and presented to the user.
ELSE IF the returned value is an array, the template found in template[‘template_file’] is called and calls to modules found inside the template file are then called to build the page. Other values of the returned array are used for the page build, and passed to calls for module models.
Default Model name: DefaultModel
Internal DefaultModel Methods
Returns either FALSE or an associative array of data collected from several tables by accessing several other methods from within the model class.
‘page’ => array(), // Array of data returned from getPageByURI()
‘section’ => array(), // Array of data returned from getSectionData()
‘template’ => array(), // Array of data returned from getTemplateData()
The first internal method accessed by getPageInitData() is getPageByURI($page_uri).
If this returned value is FALSE, then it returns FALSE and no other methods are accessed.
ELSE IF the returned value is not FALSE, then the other methods are accessed in this order:
Returns either FALSE or an array of all fields from the ‘pages’ table where ‘page_path’ match the $page_uri value.
Returns an array of all fields from the ‘sections’ table where the field ‘section_id’ matches the value of $section_id
Accesses the ‘template_map’ table to retrieve the value of the ‘template_id’ field where ‘page_id’ matches the value of $page_id.
Returns either an integer (template_id) or FALSE (no matching page_id found)
Accesses the ‘templates’ table to retrieve either the matching data, or the data marked as default.
If a $template_id is not FALSE – Return an array of all fields where the ‘template_id’ matches the value of $template_id.
ELSE IF $template_id is equal to FALSE – Find the entry marked as ‘default’ and return the field values from that row
For programming and general questions on Zend Framework
1 post • Page 1 of 1