[Solar-svn] Revision 2869
pmjones at solarphp.com
pmjones at solarphp.com
Sat Oct 13 08:43:00 CDT 2007
Solar/App/Base/Layout: Individual main layout files are now essentially identical; the _head.php partial automatically loads the correct CSS layout file based on the layout name. Also, _head.php uses the new Solar_View_Helper_Head helper logic.
Modified: trunk/Solar/App/Base/Layout/1col.php
===================================================================
--- trunk/Solar/App/Base/Layout/1col.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/1col.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -20,23 +20,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
- // put these styles at the top of the stack
- $style = array(
- 'Solar/styles/cssfw/tools.css',
- 'Solar/styles/cssfw/typo.css',
- 'Solar/styles/cssfw/forms.css',
- 'Solar/styles/cssfw/layout-1col.css',
- 'Solar/styles/typo.css',
- 'Solar/styles/forms.css',
- 'Solar/styles/app/' . $this->controller . '.css',
- );
-
- // merge with overrides
- $this->layout_head['style'] = array_merge(
- (array) $style,
- (array) $this->layout_head['style']
- );
-
// generate the <head>
include $this->template('_head.php');
Modified: trunk/Solar/App/Base/Layout/_head.php
===================================================================
--- trunk/Solar/App/Base/Layout/_head.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/_head.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -17,62 +17,42 @@
?>
<head>
<?php
- // meta elements
- if (! empty($this->layout_head['meta'])) {
- foreach ((array) $this->layout_head['meta'] as $val) {
- echo " " . $this->meta($val) . "\n";
- }
+ // add meta tags
+ foreach ((array) $this->layout_head['meta'] as $val) {
+ $this->head()->addMeta($val);
}
- // title
- if (! empty($this->layout_head['title'])) {
- echo " " . $this->title($this->layout_head['title']) . "\n";
- }
+ // set the title
+ $this->head()->setTitle($this->layout_head['title']);
- // base url
- if (! empty($this->layout_head['base'])) {
- echo " " . $this->base($this->layout_head['base']) . "\n";
- }
+ // set the uri base
+ $this->head()->setBase($this->layout_head['base']);
- // links
- if (! empty($this->layout_head['link'])) {
- foreach ((array) $this->layout_head['link'] as $val) {
- echo " " . $this->link($val) . "\n";
- }
+ // add links
+ foreach ((array) $this->layout_head['link'] as $val) {
+ $this->head()->addLink($val);
}
- // javascript helper styles before app styles, so that app styles may
- // override bundled style files
- echo $this->js()->fetchStyles();
+ // add baseline styles
+ $this->head()->addStyleBase("Solar/styles/cssfw/tools.css")
+ ->addStyleBase("Solar/styles/cssfw/typo.css")
+ ->addStyleBase("Solar/styles/cssfw/forms.css")
+ ->addStyleBase("Solar/styles/cssfw/layout-{$this->layout}.css")
+ ->addStyleBase("Solar/styles/typo.css")
+ ->addStyleBase("Solar/styles/forms.css")
+ ->addStyleBase("Solar/styles/app/{$this->controller}.css");
- // styles
- if (! empty($this->layout_head['style'])) {
- foreach ((array) $this->layout_head['style'] as $val) {
- settype($val, 'array');
- if (empty($val[0])) $val[0] = null;
- if (empty($val[1])) $val[1] = array();
- echo " " . $this->style($val[0], $val[1]) . "\n";
- }
+ // additional baseline styles
+ foreach ((array) $this->layout_head['style'] as $val) {
+ $this->head()->addStyleBase($val);
}
- // load helper-required scripts before app scripts, so that app scripts
- // may rely on bundled script files
- echo $this->js()->fetchFiles();
-
- // *now* the app script overrides
- if (! empty($this->layout_head['script'])) {
- foreach ((array) $this->layout_head['script'] as $val) {
- settype($val, 'array');
- if (empty($val[0])) $val[0] = null;
- if (empty($val[1])) $val[1] = array();
- echo " " . $this->script($val[0], $val[1]) . "\n";
- }
+ // additional baseline scripts
+ foreach ((array) $this->layout_head['script'] as $val) {
+ $this->head()->addScriptBase($val);
}
- // finally, any inline scripts
- echo $this->js()->fetchInline();
-
- /** @todo object */
+ // done!
+ echo $this->head()->fetch();
?>
</head>
-
Modified: trunk/Solar/App/Base/Layout/navleft-1col.php
===================================================================
--- trunk/Solar/App/Base/Layout/navleft-1col.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/navleft-1col.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -20,23 +20,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
- // put these styles at the top of the stack
- $style = array(
- 'Solar/styles/cssfw/tools.css',
- 'Solar/styles/cssfw/typo.css',
- 'Solar/styles/cssfw/forms.css',
- 'Solar/styles/cssfw/layout-navleft-1col.css',
- 'Solar/styles/typo.css',
- 'Solar/styles/forms.css',
- 'Solar/styles/app/' . $this->controller . '.css',
- );
-
- // merge with overrides
- $this->layout_head['style'] = array_merge(
- (array) $style,
- (array) $this->layout_head['style']
- );
-
// generate the <head>
include $this->template('_head.php');
Modified: trunk/Solar/App/Base/Layout/navleft-2col.php
===================================================================
--- trunk/Solar/App/Base/Layout/navleft-2col.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/navleft-2col.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -20,23 +20,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
- // put these styles at the top of the stack
- $style = array(
- 'Solar/styles/cssfw/tools.css',
- 'Solar/styles/cssfw/typo.css',
- 'Solar/styles/cssfw/forms.css',
- 'Solar/styles/cssfw/layout-navleft-2col.css',
- 'Solar/styles/typo.css',
- 'Solar/styles/forms.css',
- 'Solar/styles/app/' . $this->controller . '.css',
- );
-
- // merge with overrides
- $this->layout_head['style'] = array_merge(
- (array) $style,
- (array) $this->layout_head['style']
- );
-
// generate the <head>
include $this->template('_head.php');
Modified: trunk/Solar/App/Base/Layout/navtop-1col.php
===================================================================
--- trunk/Solar/App/Base/Layout/navtop-1col.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/navtop-1col.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -20,23 +20,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
- // put these styles at the top of the stack
- $style = array(
- 'Solar/styles/cssfw/tools.css',
- 'Solar/styles/cssfw/typo.css',
- 'Solar/styles/cssfw/forms.css',
- 'Solar/styles/cssfw/layout-navtop-1col.css',
- 'Solar/styles/typo.css',
- 'Solar/styles/forms.css',
- 'Solar/styles/app/' . $this->controller . '.css',
- );
-
- // merge with overrides
- $this->layout_head['style'] = array_merge(
- (array) $style,
- (array) $this->layout_head['style']
- );
-
// generate the <head>
include $this->template('_head.php');
Modified: trunk/Solar/App/Base/Layout/navtop-3col.php
===================================================================
--- trunk/Solar/App/Base/Layout/navtop-3col.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/navtop-3col.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -21,23 +21,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
- // put these styles at the top of the stack
- $style = array(
- 'Solar/styles/cssfw/tools.css',
- 'Solar/styles/cssfw/typo.css',
- 'Solar/styles/cssfw/forms.css',
- 'Solar/styles/cssfw/layout-navleft-3col.css',
- 'Solar/styles/typo.css',
- 'Solar/styles/forms.css',
- 'Solar/styles/app/' . $this->controller . '.css',
- );
-
- // merge with overrides
- $this->layout_head['style'] = array_merge(
- (array) $style,
- (array) $this->layout_head['style']
- );
-
// generate the <head>
include $this->template('_head.php');
Modified: trunk/Solar/App/Base/Layout/navtop-localleft.php
===================================================================
--- trunk/Solar/App/Base/Layout/navtop-localleft.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/navtop-localleft.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -21,23 +21,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
- // put these styles at the top of the stack
- $style = array(
- 'Solar/styles/cssfw/tools.css',
- 'Solar/styles/cssfw/typo.css',
- 'Solar/styles/cssfw/forms.css',
- 'Solar/styles/cssfw/layout-navtop-localleft.css',
- 'Solar/styles/typo.css',
- 'Solar/styles/forms.css',
- 'Solar/styles/app/' . $this->controller . '.css',
- );
-
- // merge with overrides
- $this->layout_head['style'] = array_merge(
- (array) $style,
- (array) $this->layout_head['style']
- );
-
// generate the <head>
include $this->template('_head.php');
Modified: trunk/Solar/App/Base/Layout/navtop-localright.php
===================================================================
--- trunk/Solar/App/Base/Layout/navtop-localright.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/navtop-localright.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -21,23 +21,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
- // put these styles at the top of the stack
- $style = array(
- 'Solar/styles/cssfw/tools.css',
- 'Solar/styles/cssfw/typo.css',
- 'Solar/styles/cssfw/forms.css',
- 'Solar/styles/cssfw/layout-navtop-localright.css',
- 'Solar/styles/typo.css',
- 'Solar/styles/forms.css',
- 'Solar/styles/app/' . $this->controller . '.css',
- );
-
- // merge with overrides
- $this->layout_head['style'] = array_merge(
- (array) $style,
- (array) $this->layout_head['style']
- );
-
// generate the <head>
include $this->template('_head.php');
Modified: trunk/Solar/App/Base/Layout/navtop-subright.php
===================================================================
--- trunk/Solar/App/Base/Layout/navtop-subright.php 2007-10-13 13:40:17 UTC (rev 2868)
+++ trunk/Solar/App/Base/Layout/navtop-subright.php 2007-10-13 13:43:00 UTC (rev 2869)
@@ -21,23 +21,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
- // put these styles at the top of the stack
- $style = array(
- 'Solar/styles/cssfw/tools.css',
- 'Solar/styles/cssfw/typo.css',
- 'Solar/styles/cssfw/forms.css',
- 'Solar/styles/cssfw/layout-navtop-subright.css',
- 'Solar/styles/typo.css',
- 'Solar/styles/forms.css',
- 'Solar/styles/app/' . $this->controller . '.css',
- );
-
- // merge with overrides
- $this->layout_head['style'] = array_merge(
- (array) $style,
- (array) $this->layout_head['style']
- );
-
// generate the <head>
include $this->template('_head.php');
More information about the Solar-svn
mailing list