Prev | Current Page 85 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

To create the object, we need to pass the
adapter name and an array of configuration parameters. Zend_Config??™s nested parameter system comes into its
own here as we can use the asArray() function to retrieve a subsection??™s keys as an associative array ready for
passing to Zend_Db::factory() as shown:
// set up database
$db = Zend_Db::factory($config->db->adapter, $config->db->config->asArray());
Zend_Db_Table::setDefaultAdapter($db);
Zend::register('db', $db);
Again, we register the database with the registry and with Zend_Db_Table. As our models will be derived
from Zend_Db_Table, the registry will rarely be used.
3.3 Two-Step View
All but the smallest of websites have common display elements on all pages. Usually this includes the header,
footer and the navigation elements, but could also include advertising banners and other elements as required
by the site??™s design. Within the current design of the ViewRenderer, the view template associated with the
current action is automatically rendered. One solution, therefore is to add two includes to every view template
like this:

page title


body copy here



The main problem is that we are repeating those two lines of code in every single view template.


Pages:
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
mieszkanie sosnowiec nieruchomości szczecin ATB Regały prezenty