View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

{zone-data:component-name}
Zend_View_Helper_* Additions
{zone-data}

{zone-data:proposer-list}
[~ralph]
{zone-data}

{zone-data:revision}
1.0 - 10 July 2007: Initial Proposal
{zone-data}

{zone-data:overview}
Zend_View_Helper_* (Doctype, HeadBase, HeadLink, HeadMeta, HeadScript, HeadStyle, HeadTitle) allow developers to injects view script dependencies into a master layout. See usage cases below.
{zone-data}

{zone-data:references}
{zone-data}

{zone-data:requirements}
These components (while not nessissary) do work best when combined with a Two-Step approach to formalizing a layout.
{zone-data}

{zone-data:dependencies}
* Zend_View_Helper
* Zend_Exception
{zone-data}

{zone-data:operation}

{zone-data}

{zone-data:milestones}

{zone-data}

{zone-data:class-list}
* Zend_View_Helper_Doctype - for doctype printing and tracking, other helpers would check this to determine if xhtml is in use
* Zend_View_Helper_HeadBase - for appending the base url to a page
* Zend_View_Helper_HeadLink - for appending links to the head section, specifically stylesheets
* Zend_View_Helper_HeadMeta - for appending meta-data to head sections
* Zend_View_Helper_HeadScript - for appending js files and js snippets for inclusion in the head section
* Zend_View_Helper_HeadStyle - for appending free floating style sections to head section
* Zend_View_Helper_HeadTitle - allowing the setting of snipptes of a title from view scripts, for inclusion in overall layout
{zone-data}

{zone-data:use-cases}
||UC-01||
{code}
Doctype usage:
<?php echo $this->doctype('XHTML1_STRICT'); ?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
...
{code}

||UC-02||
Sample Head section:
{code}


<title>Ralph Schindler</title>

<?
echo $this->headLink()
->setIndent(' ')
->appendStylesheet('/styles/main.css', 'screen')
->appendStylesheet('/styles/main-ie.css', 'screen', 'gte IE 7')
->appendStylesheet('/styles/main-ie6.css', 'screen', 'lt IE 7')
->appendAlternate('feeds/blog/', 'application/rss+xml', 'Ralph Schindler');
?>

<?
echo $this->headScript()
->setIndent(' ')
->appendScriptFile('/scripts/test.js');
?>
{code}

{zone-data}

{zone-data:skeletons}
{code}
class Zend_View_Helper_Doctype
{

const XHTML1_STRICT = 'XHTML1_STRICT';
const XHTML1_TRANSITIONAL = 'XHTML1_TRANSITIONAL';
const XHTML1_FRAMESET = 'XHTML1_FRAMESET';
const HTML4_STRICT = 'HTML4_STRICT';
const HTML4_LOOSE = 'HTML4_LOOSE';
const HTML4_FRAMESET = 'HTML4_FRAMESET';
const CUSTOM_XHTML = 'CUSTOM_XHTML';
const CUSTOM = 'CUSTOM';

protected $_doctype = self::HTML4_LOOSE;

public function doctype($doctype);
public function getDoctype();
public function setDoctype($doctype);

}
{code}

{code}
class Zend_View_Helper_HeadBase
{
public function headBase();
}
{code}

{code}
/**
* Zend_Layout_View_Helper_HeadLink
*
* @see http://www.w3.org/TR/xhtml1/dtds.html
*/
class Zend_View_Helper_HeadLink extends ArrayObject
{
protected $_links = array();
protected $_validAttributes = array('charset', 'href', 'hreflang', 'media', 'rel', 'rev', 'type');
protected $_indent = null;

public function __construct();

public function headLink()
public function append($attributes, $index = null)
public function getIterator()
public function count()
public function setIndent($indent)
public function toString($indent = null)
public function __toString()
public function appendStylesheet($href, $media = 'screen', $conditionalStylesheet = null)
public function appendAlternate($href, $type, $title)

// Navigation? need to find docs on this
//public function appendStart()
//public function appendContents()
//public function appendPrev()
//public function appendNext()
//public function appendIndex()
//public function appendEnd()
//public function appendGlossary()
//public function appendAppendix()
//public function appendHelp()
//public function appendBookmark()

// Other?
//public function appendCopyright()
//public function appendChapter()
//public function appendSection()
//public function appendSubsection()
}
{code}


{code}

class Zend_View_Helper_HeadMeta
{

public function headMeta();
public function appendKeywords($keywords);
public function setContentType($contentType);
public function appendDescription($description);
/* .... other undecided methods here .... */

}
{code}

{code}
class Zend_View_Helper_HeadScript extends ArrayObject implements Countable
{

protected $_view;
protected $_scripts = array();
protected $_indent = null;
public function headScript()
public function append($attributes, $content = null, $index = null)
public function appendScriptFile($src, $type = 'text/javascript')
public function appendScript($script, $type = 'text/javascript')
public function count()
public function setIndent($indent)
public function toString($indent = null)
public function __toString()
public function setView($view)
}
{code}

{code}
class Zend_View_Helper_HeadStyle
{
public function headStyle()
public function appendStyle($styleCode);
public function __toString()
}
{code}

{code}
class Zend_View_Helper_HeadTitle
{
protected $_prefix = null;
protected $_title = null;
protected $_postfix = null;
public function headTitle($title = null, $prefix = null, $postfix = null)
public function setTitle($title)
public function appendTitle($title)
public function getTitle()
public function setPrefix($prefix)
public function getPrefix()
public function setPostfix($postfix)
public function getPostfix()
public function toString()
public function __toString()
}
{code}

{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>