1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect3 id="zend.view.helpers.initial.navigation">
4 <title>Navigation Helpers</title>
7 The navigation helpers are used for rendering navigational elements
8 from <link linkend="zend.navigation.containers">Zend_Navigation_Container</link>
13 There are 5 built-in helpers:
20 linkend="zend.view.helpers.initial.navigation.breadcrumbs">Breadcrumbs</link>,
21 used for rendering the path to the currently active page.
27 <link linkend="zend.view.helpers.initial.navigation.links">Links</link>,
28 used for rendering navigational head links (e.g.
29 <command><link rel="next" href="..." /></command>)
35 <link linkend="zend.view.helpers.initial.navigation.menu">Menu</link>,
36 used for rendering menus.
42 <link linkend="zend.view.helpers.initial.navigation.sitemap">Sitemap</link>,
43 used for rendering sitemaps conforming to the <ulink
44 url="http://www.sitemaps.org/protocol.php">Sitemaps <acronym>XML</acronym>
52 linkend="zend.view.helpers.initial.navigation.navigation">Navigation</link>,
53 used for proxying calls to other navigational helpers.
59 All built-in helpers extend
60 <classname>Zend_View_Helper_Navigation_HelperAbstract</classname>, which
61 adds integration with <link linkend="zend.acl">ACL</link> and
62 <link linkend="zend.translate">translation</link>. The abstract class
63 implements the interface
64 <classname>Zend_View_Helper_Navigation_Helper</classname>, which
65 defines the following methods:
71 <methodname>getContainer()</methodname> and <methodname>setContainer()</methodname>
72 gets and sets the navigation container the helper should operate on by default, and
73 <methodname>hasContainer()</methodname> checks if the helper
74 has container registered.
80 <methodname>getTranslator()</methodname> and
81 <methodname>setTranslator()</methodname> gets and sets the
82 translator used for translating labels and titles.
83 <methodname>getUseTranslator()</methodname> and
84 <methodname>setUseTranslator()</methodname> controls whether
85 the translator should be enabled. The method
86 <methodname>hasTranslator()</methodname> checks if the helper has
87 a translator registered.
93 <methodname>getAcl()</methodname>, <methodname>setAcl()</methodname>,
94 <methodname>getRole()</methodname> and <methodname>setRole()</methodname>,
95 gets and sets <acronym>ACL</acronym> (<classname>Zend_Acl</classname>) instance and
96 role (<type>String</type> or
97 <classname>Zend_Acl_Role_Interface</classname>) used for
98 filtering out pages when rendering. <methodname>getUseAcl()</methodname> and
99 <methodname>setUseAcl()</methodname> controls whether <acronym>ACL</acronym> should
100 be enabled. The methods <methodname>hasAcl()</methodname> and
101 <methodname>hasRole()</methodname> checks if the helper has an
102 <acronym>ACL</acronym> instance or a role registered.
108 <methodname>__toString()</methodname>, magic method to ensure that
109 helpers can be rendered by echoing the helper instance directly.
115 <methodname>render()</methodname>, must be implemented by concrete
116 helpers to do the actual rendering.
122 In addition to the method stubs from the interface, the abstract
123 class also implements the following methods:
129 <methodname>getIndent()</methodname> and <methodname>setIndent()</methodname>
130 gets and sets indentation. The setter accepts a <type>String</type> or an
131 <type>Integer</type>. In the case of an <type>Integer</type>, the helper will use
132 the given number of spaces for indentation. I.e.,
133 <methodname>setIndent(4)</methodname> means 4 initial spaces of
134 indentation. Indentation can be specified for all helpers
135 except the Sitemap helper.
141 <methodname>getMinDepth()</methodname> and <methodname>setMinDepth()</methodname>
142 gets and sets the minimum depth a page must have to be included by the helper.
143 Setting <constant>NULL</constant> means no minimum depth.
149 <methodname>getMaxDepth()</methodname> and <methodname>setMaxDepth()</methodname>
150 gets and sets the maximum depth a page can have to be included by the helper.
151 Setting <constant>NULL</constant> means no maximum depth.
157 <methodname>getRenderInvisible()</methodname> and
158 <methodname>setRenderInvisible()</methodname> gets and sets whether to
159 render items that have been marked as invisible or not.
165 <methodname>__call()</methodname> is used for proxying calls to the
166 container registered in the helper, which means you can
167 call methods on a helper as if it was a container. See <link
168 linkend="zend.view.helpers.initial.navigation.proxy.example">example</link>
175 <methodname>findActive($container, $minDepth, $maxDepth)</methodname>
176 is used for finding the deepest active page in the given
177 container. If depths are not given, the method will use
178 the values retrieved from <methodname>getMinDepth()</methodname> and
179 <methodname>getMaxDepth()</methodname>. The deepest active page must
180 be between <varname>$minDepth</varname> and <varname>$maxDepth</varname>
181 inclusively. Returns an array containing a reference to the
182 found page instance and the depth at which the page was
189 <methodname>htmlify()</methodname> renders an <emphasis>'a'</emphasis>
190 <acronym>HTML</acronym> element from a <classname>Zend_Navigation_Page</classname>
197 <methodname>accept()</methodname> is used for determining if a page
198 should be accepted when iterating containers. This method
199 checks for page visibility and verifies that the helper's
200 role is allowed access to the page's resource and privilege.
206 The static method <methodname>setDefaultAcl()</methodname> is used for setting
207 a default <acronym>ACL</acronym> object that will be used by helpers.
213 The static method <methodname>setDefaultRole()</methodname> is used for setting
214 a default <acronym>ACL</acronym> that will be used by helpers
220 If a navigation container is not explicitly set in a helper using
221 <command>$helper->setContainer($nav)</command>, the helper will look
222 for a container instance with the key <classname>Zend_Navigation</classname> in
223 <link linkend="zend.registry">the registry</link>.
224 If a container is not explicitly set or found in the registry, the
225 helper will create an empty <classname>Zend_Navigation</classname>
226 container when calling <command>$helper->getContainer()</command>.
229 <example id="zend.view.helpers.initial.navigation.proxy.example">
230 <title>Proxying calls to the navigation container</title>
233 Navigation view helpers use the magic method <methodname>__call()</methodname>
234 to proxy method calls to the navigation container that is
235 registered in the view helper.
238 <programlisting language="php"><![CDATA[
239 $this->navigation()->addPage(array(
241 'label' => 'New page'));
245 The call above will add a page to the container in the
246 <classname>Navigation</classname> helper.
250 <sect4 id="zend.view.helpers.initial.navigation.i18n">
251 <title>Translation of labels and titles</title>
254 The navigation helpers support translation of page labels and titles.
255 You can set a translator of type <classname>Zend_Translate</classname>
256 or <classname>Zend_Translate_Adapter</classname> in the helper using
257 <command>$helper->setTranslator($translator)</command>, or like with other
258 I18n-enabled components; by adding the translator to
259 <link linkend="zend.registry">the registry</link> by using the key
260 <classname>Zend_Translate</classname>.
264 If you want to disable translation, use
265 <command>$helper->setUseTranslator(false)</command>.
270 <link linkend="zend.view.helpers.initial.navigation.navigation">proxy
271 helper</link> will inject its own translator to the helper it
272 proxies to if the proxied helper doesn't already have a translator.
277 There is no translation in the sitemap helper, since there
278 are no page labels or titles involved in an <acronym>XML</acronym> sitemap.
283 <sect4 id="zend.view.helpers.initial.navigation.acl">
284 <title>Integration with ACL</title>
287 All navigational view helpers support <acronym>ACL</acronym> inherently from the
288 class <classname>Zend_View_Helper_Navigation_HelperAbstract</classname>.
289 A <classname>Zend_Acl</classname> object can be assigned to
290 a helper instance with <code>$helper->setAcl($acl)</code>, and role
291 with <code>$helper->setRole('member')</code> or
292 <code>$helper->setRole(new Zend_Acl_Role('member'))</code> . If <acronym>ACL</acronym>
293 is used in the helper, the role in the helper must be allowed by
294 the <acronym>ACL</acronym> to access a page's <code>resource</code> and/or have the
295 page's <code>privilege</code> for the page to be included when
300 If a page is not accepted by <acronym>ACL</acronym>, any descendant page will also
301 be excluded from rendering.
306 <link linkend="zend.view.helpers.initial.navigation.navigation">proxy
307 helper</link> will inject its own <acronym>ACL</acronym> and role to the helper it
308 proxies to if the proxied helper doesn't already have any.
312 The examples below all show how <acronym>ACL</acronym> affects rendering.
316 <sect4 id="zend.view.helpers.initial.navigation.setup">
317 <title>Navigation setup used in examples</title>
320 This example shows the setup of a navigation container for a
321 fictional software company.
331 The domain for the site is <code>www.example.com</code>.
337 Interesting page properties are marked with a comment.
343 Unless otherwise is stated in other examples, the user
344 is requesting the <acronym>URL</acronym>
345 <code>http://www.example.com/products/server/faq/</code>,
346 which translates to the page labeled <constant>FAQ</constant>
347 under <code>Foo Server</code>.
353 The assumed <acronym>ACL</acronym> and router setup is shown below the
359 <programlisting language="php"><![CDATA[
361 * Navigation container (config/array)
363 * Each element in the array will be passed to
364 * Zend_Navigation_Page::factory() when constructing
365 * the navigation container below.
370 'title' => 'Go Home',
371 'module' => 'default',
372 'controller' => 'index',
374 'order' => -100 // make sure home is the first page
377 'label' => 'Special offer this week only!',
379 'controller' => 'offer',
380 'action' => 'amazing',
381 'visible' => false // not visible
384 'label' => 'Products',
385 'module' => 'products',
386 'controller' => 'index',
390 'label' => 'Foo Server',
391 'module' => 'products',
392 'controller' => 'server',
397 'module' => 'products',
398 'controller' => 'server',
401 'canonical' => 'http://www.example.com/?page=faq',
402 'alternate' => array(
403 'module' => 'products',
404 'controller' => 'server',
406 'params' => array('format' => 'xml')
411 'label' => 'Editions',
412 'module' => 'products',
413 'controller' => 'server',
414 'action' => 'editions'
417 'label' => 'System Requirements',
418 'module' => 'products',
419 'controller' => 'server',
420 'action' => 'requirements'
425 'label' => 'Foo Studio',
426 'module' => 'products',
427 'controller' => 'studio',
431 'label' => 'Customer Stories',
432 'module' => 'products',
433 'controller' => 'studio',
434 'action' => 'customers'
437 'label' => 'Support',
438 'module' => 'prodcts',
439 'controller' => 'studio',
440 'action' => 'support'
447 'label' => 'Company',
448 'title' => 'About us',
449 'module' => 'company',
450 'controller' => 'about',
454 'label' => 'Investor Relations',
455 'module' => 'company',
456 'controller' => 'about',
457 'action' => 'investors'
461 'class' => 'rss', // class
462 'module' => 'company',
463 'controller' => 'news',
467 'label' => 'Press Releases',
468 'module' => 'company',
469 'controller' => 'news',
473 'label' => 'Archive',
474 'route' => 'archive', // route
475 'module' => 'company',
476 'controller' => 'news',
477 'action' => 'archive'
484 'label' => 'Community',
485 'module' => 'community',
486 'controller' => 'index',
490 'label' => 'My Account',
491 'module' => 'community',
492 'controller' => 'account',
494 'resource' => 'mvc:community.account' // resource
498 'uri' => 'http://forums.example.com/',
499 'class' => 'external' // class
504 'label' => 'Administration',
506 'controller' => 'index',
508 'resource' => 'mvc:admin', // resource
511 'label' => 'Write new article',
513 'controller' => 'post',
520 // Create container from array
521 $container = new Zend_Navigation($pages);
523 // Store the container in the proxy helper:
524 $view->getHelper('navigation')->setContainer($container);
527 $view->navigation($container);
529 // ...or store it in the reigstry:
530 Zend_Registry::set('Zend_Navigation', $container);
534 In addition to the container above, the following setup is assumed:
537 <programlisting language="php"><![CDATA[
538 // Setup router (default routes and 'archive' route):
539 $front = Zend_Controller_Front::getInstance();
540 $router = $front->getRouter();
541 $router->addDefaultRoutes();
544 new Zend_Controller_Router_Route(
547 'module' => 'company',
548 'controller' => 'news',
549 'action' => 'archive',
550 'year' => (int) date('Y') - 1
552 array('year' => '\d+')
557 $acl = new Zend_Acl();
558 $acl->addRole(new Zend_Acl_Role('member'));
559 $acl->addRole(new Zend_Acl_Role('admin'));
560 $acl->add(new Zend_Acl_Resource('mvc:admin'));
561 $acl->add(new Zend_Acl_Resource('mvc:community.account'));
562 $acl->allow('member', 'mvc:community.account');
563 $acl->allow('admin', null);
565 // Store ACL and role in the proxy helper:
566 $view->navigation()->setAcl($acl)->setRole('member');
568 // ...or set default ACL and role statically:
569 Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($acl);
570 Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole('member');
574 <sect4 id="zend.view.helpers.initial.navigation.breadcrumbs">
575 <title>Breadcrumbs Helper</title>
578 Breadcrumbs are used for indicating where in a sitemap
579 a user is currently browsing, and are typically rendered
580 like this: "You are here: Home > Products > FantasticProduct 1.0".
581 The breadcrumbs helper follows the guidelines from <ulink
582 url="http://developer.yahoo.com/ypatterns/pattern.php?pattern=breadcrumbs">Breadcrumbs
583 Pattern - Yahoo! Design Pattern Library</ulink>,
584 and allows simple customization (minimum/maximum depth, indentation,
585 separator, and whether the last element should be linked), or
586 rendering using a partial view script.
590 The Breadcrumbs helper works like this; it finds the deepest active
591 page in a navigation container, and renders an upwards path to
592 the root. For <acronym>MVC</acronym> pages, the "activeness" of a page is
593 determined by inspecting the request object, as stated in the
594 section on <link linkend="zend.navigation.pages.mvc">Zend_Navigation_Page_Mvc</link>.
598 The helper sets the <code>minDepth</code> property to 1 by default,
599 meaning breadcrumbs will not be rendered if the deepest active page
600 is a root page. If <code>maxDepth</code> is specified, the helper
601 will stop rendering when at the specified depth (e.g. stop at level
602 2 even if the deepest active page is on level 3).
606 Methods in the breadcrumbs helper:
612 <code>{get|set}Separator()</code> gets/sets separator
613 string that is used between breadcrumbs. Defualt is
614 <code>' &gt; '</code>.
620 <code>{get|set}LinkLast()</code> gets/sets whether the
621 last breadcrumb should be rendered as an anchor or not.
622 Default is <constant>FALSE</constant>.
628 <code>{get|set}Partial()</code> gets/sets a partial view
629 script that should be used for rendering breadcrumbs.
630 If a partial view script is set, the helper's
631 <methodname>render()</methodname> method will use the
632 <methodname>renderPartial()</methodname> method. If no partial is
633 set, the <methodname>renderStraight()</methodname> method is used.
634 The helper expects the partial to be a <type>String</type>
635 or an <type>Array</type> with two elements. If the partial
636 is a <type>String</type>, it denotes the name of the partial
637 script to use. If it is an <type>Array</type>, the first
638 element will be used as the name of the partial view
639 script, and the second element is the module where the
646 <methodname>renderStraight()</methodname> is the default render
653 <methodname>renderPartial()</methodname> is used for rendering
654 using a partial view script.
659 <example id="zend.view.helpers.initial.navigation.breadcrumbs.example1">
660 <title>Rendering breadcrumbs</title>
663 This example shows how to render breadcrumbs with default
667 <programlisting language="php"><![CDATA[
668 In a view script or layout:
669 <?php echo $this->navigation()->breadcrumbs(); ?>
671 The two calls above take advantage of the magic __toString() method,
672 and are equivalent to:
673 <?php echo $this->navigation()->breadcrumbs()->render(); ?>
676 <a href="/products">Products</a> > <a href="/products/server">Foo Server</a> > FAQ
680 <example id="zend.view.helpers.initial.navigation.breadcrumbs.example2">
681 <title>Specifying indentation</title>
684 This example shows how to render breadcrumbs with initial
688 <programlisting language="php"><![CDATA[
689 Rendering with 8 spaces indentation:
690 <?php echo $this->navigation()->breadcrumbs()->setIndent(8);?>
693 <a href="/products">Products</a> > <a href="/products/server">Foo Server</a> > FAQ
697 <example id="zend.view.helpers.initial.navigation.breadcrumbs.example3">
698 <title>Customize breadcrumbs output</title>
701 This example shows how to customze breadcrumbs output by
702 specifying various options.
705 <programlisting language="php"><![CDATA[
706 In a view script or layout:
709 echo $this->navigation()
711 ->setLinkLast(true) // link last page
712 ->setMaxDepth(1) // stop at level 1
713 ->setSeparator(' ▶' . PHP_EOL); // cool separator with newline
717 <a href="/products">Products</a> ▶
718 <a href="/products/server">Foo Server</a>
720 /////////////////////////////////////////////////////
722 Setting minimum depth required to render breadcrumbs:
725 $this->navigation()->breadcrumbs()->setMinDepth(10);
726 echo $this->navigation()->breadcrumbs();
730 Nothing, because the deepest active page is not at level 10 or deeper.
734 <example id="zend.view.helpers.initial.navigation.breadcrumbs.example4">
735 <title>Rendering breadcrumbs using a partial view script</title>
738 This example shows how to render customized breadcrumbs using
739 a partial vew script. By calling <methodname>setPartial()</methodname>,
740 you can specify a partial view script that will be used
741 when calling <methodname>render()</methodname>. When a partial is specified,
742 the <methodname>renderPartial()</methodname> method will be called. This
743 method will find the deepest active page and pass an array
744 of pages that leads to the active page to the partial view
752 <programlisting language="php"><![CDATA[
754 echo $this->navigation()->breadcrumbs()
755 ->setPartial(array('breadcrumbs.phtml', 'default'));
760 <code>application/modules/default/views/breadcrumbs.phtml</code>:
763 <programlisting language="php"><![CDATA[
764 echo implode(', ', array_map(
765 create_function('$a', 'return $a->getLabel();'),
773 <programlisting language="php"><![CDATA[
774 Products, Foo Server, FAQ
779 <sect4 id="zend.view.helpers.initial.navigation.links">
780 <title>Links Helper</title>
783 The links helper is used for rendering <acronym>HTML</acronym> <constant>LINK</constant>
784 elements. Links are used for describing document relationships
785 of the currently active page. Read more about links and link
786 types at <ulink url="http://www.w3.org/TR/html4/struct/links.html#h-12.3">Document
787 relationships: the LINK element (HTML4 W3C Rec.)</ulink>
789 url="http://www.w3.org/TR/html4/types.html#h-6.12">Link types (HTML4 W3C
790 Rec.)</ulink> in the <acronym>HTML</acronym>4 W3C Recommendation.
794 There are two types of relations; forward and reverse, indicated
795 by the keyords <code>'rel'</code> and <code>'rev'</code>. Most
796 methods in the helper will take a <varname>$rel</varname> param, which
797 must be either <code>'rel'</code> or <code>'rev'</code>. Most
798 methods also take a <varname>$type</varname> param, which is used
799 for specifying the link type (e.g. alternate, start, next, prev,
804 Relationships can be added to page objects manually, or found
805 by traversing the container registered in the helper. The method
806 <methodname>findRelation($page, $rel, $type)</methodname> will first try
807 to find the given <varname>$rel</varname> of <varname>$type</varname> from
808 the <varname>$page</varname> by calling <code>$page->findRel($type)</code>
809 or <code>$page->findRel($type)</code>. If the <varname>$page</varname>
810 has a relation that can be converted to a page instance, that
811 relation will be used. If the <varname>$page</varname> instance doesn't
812 have the specified <varname>$type</varname>, the helper will look for
813 a method in the helper named <code>search$rel$type</code> (e.g.
814 <methodname>searchRelNext()</methodname> or
815 <methodname>searchRevAlternate()</methodname>).
816 If such a method exists, it will be used for determining the
817 <varname>$page</varname>'s relation by traversing the container.
821 Not all relations can be determined by traversing the container.
822 These are the relations that will be found by searching:
828 <methodname>searchRelStart()</methodname>, forward 'start'
829 relation: the first page in the container.
835 <methodname>searchRelNext()</methodname>, forward 'next'
836 relation; finds the next page in the container, i.e.
837 the page after the active page.
843 <methodname>searchRelPrev()</methodname>, forward 'prev'
844 relation; finds the previous page, i.e. the page before
851 <methodname>searchRelChapter()</methodname>, forward 'chapter'
852 relations; finds all pages on level 0 except the 'start'
853 relation or the active page if it's on level 0.
859 <methodname>searchRelSection()</methodname>, forward 'section'
860 relations; finds all child pages of the active page if
861 the active page is on level 0 (a 'chapter').
867 <methodname>searchRelSubsection()</methodname>, forward 'subsection'
868 relations; finds all child pages of the active page if
869 the active pages is on level 1 (a 'section').
875 <methodname>searchRevSection()</methodname>, reverse 'section'
876 relation; finds the parent of the active page if the
877 active page is on level 1 (a 'section').
883 <methodname>searchRevSubsection()</methodname>, reverse 'subsection'
884 relation; finds the parent of the active page if the
885 active page is on level 2 (a 'subsection').
892 When looking for relations in the page instance
893 (<code>$page->getRel($type)</code> or
894 <code>$page->getRev($type)</code>), the helper accepts the
895 values of type <type>String</type>, <type>Array</type>,
896 <classname>Zend_Config</classname>, or
897 <classname>Zend_Navigation_Page</classname>. If a string
898 is found, it will be converted to a
899 <classname>Zend_Navigation_Page_Uri</classname>. If an array
900 or a config is found, it will be converted to one or several
901 page instances. If the first key of the array/config is numeric,
902 it will be considered to contain several pages, and each
903 element will be passed to the
904 <link linkend="zend.navigation.pages.factory">page factory</link>.
905 If the first key is not numeric, the array/config will be
906 passed to the page factory directly, and a single page will
912 The helper also supports magic methods for finding relations.
913 E.g. to find forward alternate relations, call
914 <code>$helper->findRelAlternate($page)</code>, and to find
915 reverse section relations, call
916 <code>$helper->findRevSection($page)</code>. Those calls correspond
917 to <code>$helper->findRelation($page, 'rel', 'alternate');</code>
918 and <code>$helper->findRelation($page, 'rev', 'section');</code>
923 To customize which relations should be rendered, the helper
924 uses a render flag. The render flag is an integer value, and will be
926 <ulink url="http://php.net/manual/en/language.operators.bitwise.php">bitwse
927 <code>and</code> (<code>&</code>) operation</ulink> against the
928 helper's render constants to determine if the relation that belongs
929 to the render constant should be rendered.
934 <link linkend="zend.view.helpers.initial.navigation.links.example3">example
935 below</link> for more information.
941 <constant>Zend_View_Helper_Navigation_Link::RENDER_ALTERNATE</constant>
947 <constant>Zend_View_Helper_Navigation_Link::RENDER_STYLESHEET</constant>
953 <constant>Zend_View_Helper_Navigation_Link::RENDER_START</constant>
959 <constant>Zend_View_Helper_Navigation_Link::RENDER_NEXT</constant>
965 <constant>Zend_View_Helper_Navigation_Link::RENDER_PREV</constant>
971 <constant>Zend_View_Helper_Navigation_Link::RENDER_CONTENTS</constant>
977 <constant>Zend_View_Helper_Navigation_Link::RENDER_INDEX</constant>
983 <constant>Zend_View_Helper_Navigation_Link::RENDER_GLOSSARY</constant>
989 <constant>Zend_View_Helper_Navigation_Link::RENDER_COPYRIGHT</constant>
995 <constant>Zend_View_Helper_Navigation_Link::RENDER_CHAPTER</constant>
1001 <constant>Zend_View_Helper_Navigation_Link::RENDER_SECTION</constant>
1007 <constant>Zend_View_Helper_Navigation_Link::RENDER_SUBSECTION</constant>
1013 <constant>Zend_View_Helper_Navigation_Link::RENDER_APPENDIX</constant>
1019 <constant>Zend_View_Helper_Navigation_Link::RENDER_HELP</constant>
1025 <constant>Zend_View_Helper_Navigation_Link::RENDER_BOOKMARK</constant>
1031 <constant>Zend_View_Helper_Navigation_Link::RENDER_CUSTOM</constant>
1037 <constant>Zend_View_Helper_Navigation_Link::RENDER_ALL</constant>
1043 The constants from <constant>RENDER_ALTERNATE</constant> to
1044 <constant>RENDER_BOOKMARK</constant> denote standard <acronym>HTML</acronym> link types.
1045 <constant>RENDER_CUSTOM</constant> denotes non-standard relations that
1046 specified in pages. <constant>RENDER_ALL</constant> denotes standard and
1047 non-standard relations.
1051 Methods in the links helper:
1057 <code>{get|set}RenderFlag()</code> gets/sets the render
1058 flag. Default is <constant>RENDER_ALL</constant>. See examples
1059 below on how to set the render flag.
1065 <methodname>findAllRelations()</methodname> finds all relations of
1066 all types for a given page.
1072 <methodname>findRelation()</methodname> finds all relations of a given
1073 type from a given page.
1079 <code>searchRel{Start|Next|Prev|Chapter|Section|Subsection}()</code>
1080 traverses a container to find forward relations to
1081 the start page, the next page, the previous page,
1082 chapters, sections, and subsections.
1088 <code>searchRev{Section|Subsection}()</code> traverses
1089 a container to find reverse relations to sections or
1096 <methodname>renderLink()</methodname> renders a single <code>link</code>
1102 <example id="zend.view.helpers.initial.navigation.links.example1">
1103 <title>Specify relations in pages</title>
1106 This example shows how to specify relations in pages.
1109 <programlisting language="php"><![CDATA[
1110 $container = new Zend_Navigation(array(
1112 'label' => 'Relations using strings',
1114 'alternate' => 'http://www.example.org/'
1117 'alternate' => 'http://www.example.net/'
1121 'label' => 'Relations using arrays',
1123 'alternate' => array(
1124 'label' => 'Example.org',
1125 'uri' => 'http://www.example.org/'
1130 'label' => 'Relations using configs',
1132 'alternate' => new Zend_Config(array(
1133 'label' => 'Example.org',
1134 'uri' => 'http://www.example.org/'
1139 'label' => 'Relations using pages instance',
1141 'alternate' => Zend_Navigation_Page::factory(array(
1142 'label' => 'Example.org',
1143 'uri' => 'http://www.example.org/'
1148 ]]></programlisting>
1151 <example id="zend.view.helpers.initial.navigation.links.example2">
1152 <title>Default rendering of links</title>
1155 This example shows how to render a menu from a container
1156 registered/found in the view helper.
1159 <programlisting language="php"><![CDATA[
1160 In a view script or layout:
1161 <?php echo $this->view->navigation()->links(); ?>
1164 <link rel="alternate" href="/products/server/faq/format/xml">
1165 <link rel="start" href="/" title="Home">
1166 <link rel="next" href="/products/server/editions" title="Editions">
1167 <link rel="prev" href="/products/server" title="Foo Server">
1168 <link rel="chapter" href="/products" title="Products">
1169 <link rel="chapter" href="/company/about" title="Company">
1170 <link rel="chapter" href="/community" title="Community">
1171 <link rel="canonical" href="http://www.example.com/?page=server-faq">
1172 <link rev="subsection" href="/products/server" title="Foo Server">
1173 ]]></programlisting>
1176 <example id="zend.view.helpers.initial.navigation.links.example3">
1177 <title>Specify which relations to render</title>
1180 This example shows how to specify which relations to find
1184 <programlisting language="php"><![CDATA[
1185 Render only start, next, and prev:
1186 $helper->setRenderFlag(Zend_View_Helper_Navigation_Links::RENDER_START |
1187 Zend_View_Helper_Navigation_Links::RENDER_NEXT |
1188 Zend_View_Helper_Navigation_Links::RENDER_PREV);
1191 <link rel="start" href="/" title="Home">
1192 <link rel="next" href="/products/server/editions" title="Editions">
1193 <link rel="prev" href="/products/server" title="Foo Server">
1194 ]]></programlisting>
1196 <programlisting language="php"><![CDATA[
1197 Render only native link types:
1198 $helper->setRenderFlag(Zend_View_Helper_Navigation_Links::RENDER_ALL ^
1199 Zend_View_Helper_Navigation_Links::RENDER_CUSTOM);
1202 <link rel="alternate" href="/products/server/faq/format/xml">
1203 <link rel="start" href="/" title="Home">
1204 <link rel="next" href="/products/server/editions" title="Editions">
1205 <link rel="prev" href="/products/server" title="Foo Server">
1206 <link rel="chapter" href="/products" title="Products">
1207 <link rel="chapter" href="/company/about" title="Company">
1208 <link rel="chapter" href="/community" title="Community">
1209 <link rev="subsection" href="/products/server" title="Foo Server">
1210 ]]></programlisting>
1212 <programlisting language="php"><![CDATA[
1213 Render all but chapter:
1214 $helper->setRenderFlag(Zend_View_Helper_Navigation_Links::RENDER_ALL ^
1215 Zend_View_Helper_Navigation_Links::RENDER_CHAPTER);
1218 <link rel="alternate" href="/products/server/faq/format/xml">
1219 <link rel="start" href="/" title="Home">
1220 <link rel="next" href="/products/server/editions" title="Editions">
1221 <link rel="prev" href="/products/server" title="Foo Server">
1222 <link rel="canonical" href="http://www.example.com/?page=server-faq">
1223 <link rev="subsection" href="/products/server" title="Foo Server">
1224 ]]></programlisting>
1228 <sect4 id="zend.view.helpers.initial.navigation.menu">
1229 <title>Menu Helper</title>
1232 The Menu helper is used for rendering menus from navigation
1233 containers. By default, the menu will be rendered using
1234 <acronym>HTML</acronym> <code>UL</code> and <code>LI</code> tags, but the helper also
1235 allows using a partial view script.
1239 Methods in the Menu helper:
1245 <code>{get|set}UlClass()</code> gets/sets the <acronym>CSS</acronym> class
1246 used in <methodname>renderMenu()</methodname>.
1252 <code>{get|set}OnlyActiveBranch()</code> gets/sets a flag
1253 specifying whether only the active branch of a container
1260 <code>{get|set}RenderParents()</code> gets/sets a flag
1261 specifying whether parents should be rendered when only
1262 rendering active branch of a container. If set to
1263 <constant>FALSE</constant>, only the deepest active menu will be
1270 <code>{get|set}Partial()</code> gets/sets a partial view
1271 script that should be used for rendering menu.
1272 If a partial view script is set, the helper's
1273 <methodname>render()</methodname> method will use the
1274 <methodname>renderPartial()</methodname> method. If no partial is
1275 set, the <methodname>renderMenu()</methodname> method is used.
1276 The helper expects the partial to be a <type>String</type>
1277 or an <type>Array</type> with two elements. If the partial
1278 is a <type>String</type>, it denotes the name of the partial
1279 script to use. If it is an <type>Array</type>, the first
1280 element will be used as the name of the partial view
1281 script, and the second element is the module where the
1288 <methodname>htmlify()</methodname> overrides the method from the
1289 abstract class to return <code>span</code> elements
1290 if the page has no <code>href</code>.
1296 <methodname>renderMenu($container = null, $options = array())</methodname>
1297 is the default render method, and will render a container as
1298 a <acronym>HTML</acronym> <code>UL</code> list.
1302 If <varname>$container</varname> is not given, the container
1303 registered in the helper will be rendered.
1307 <varname>$options</varname> is used for overriding options
1308 specified temporarily without rsetting the values in the
1309 helper instance. It is an associative array where each key
1310 corresponds to an option in the helper.
1320 <code>indent</code>; indentation. Expects a
1321 <type>String</type> or an <code>int</code>
1328 <code>minDepth</code>; minimum depth. Expcects
1329 an <code>int</code> or <constant>NULL</constant> (no
1336 <code>maxDepth</code>; maximum depth. Expcects
1337 an <code>int</code> or <constant>NULL</constant> (no
1344 <code>ulClass</code>; <acronym>CSS</acronym> class for
1345 <code>ul</code> element. Expects a
1346 <type>String</type>.
1352 <code>onlyActiveBranch</code>; whether only
1353 active branch should be rendered. Expects
1354 a <type>Boolean</type> value.
1360 <code>renderParents</code>; whether parents
1361 should be rendered if only rendering active
1362 branch. Expects a <type>Boolean</type> value.
1368 If an option is not given, the value set in the helper
1375 <methodname>renderPartial()</methodname> is used for rendering the menu
1376 using a partial view script.
1382 <methodname>renderSubMenu()</methodname> renders the deepest menu level
1383 of a container's active branch.
1388 <example id="zend.view.helpers.initial.navigation.menu.example1">
1389 <title>Rendering a menu</title>
1392 This example shows how to render a menu from a container
1393 registered/found in the view helper. Notice how pages
1394 are filtered out based on visibility and <acronym>ACL</acronym>.
1397 <programlisting language="php"><![CDATA[
1398 In a view script or layout:
1399 <?php echo $this->navigation()->menu()->render() ?>
1402 <?php echo $this->navigation()->menu() ?>
1405 <ul class="navigation">
1407 <a title="Go Home" href="/">Home</a>
1410 <a href="/products">Products</a>
1413 <a href="/products/server">Foo Server</a>
1416 <a href="/products/server/faq">FAQ</a>
1419 <a href="/products/server/editions">Editions</a>
1422 <a href="/products/server/requirements">System Requirements</a>
1427 <a href="/products/studio">Foo Studio</a>
1430 <a href="/products/studio/customers">Customer Stories</a>
1433 <a href="/prodcts/studio/support">Support</a>
1440 <a title="About us" href="/company/about">Company</a>
1443 <a href="/company/about/investors">Investor Relations</a>
1446 <a class="rss" href="/company/news">News</a>
1449 <a href="/company/news/press">Press Releases</a>
1452 <a href="/archive">Archive</a>
1459 <a href="/community">Community</a>
1462 <a href="/community/account">My Account</a>
1465 <a class="external" href="http://forums.example.com/">Forums</a>
1470 ]]></programlisting>
1473 <example id="zend.view.helpers.initial.navigation.menu.example2">
1474 <title>Calling renderMenu() directly</title>
1477 This example shows how to render a menu that is not
1478 registered in the view helper by calling the
1479 <methodname>renderMenu()</methodname> directly and specifying a few
1483 <programlisting language="php"><![CDATA[
1485 // render only the 'Community' menu
1486 $community = $this->navigation()->findOneByLabel('Community');
1489 'ulClass' => 'community'
1491 echo $this->navigation()
1493 ->renderMenu($community, $options);
1496 <ul class="community">
1498 <a href="/community/account">My Account</a>
1501 <a class="external" href="http://forums.example.com/">Forums</a>
1504 ]]></programlisting>
1507 <example id="zend.view.helpers.initial.navigation.menu.example3">
1508 <title>Rendering the deepest active menu</title>
1511 This example shows how the <methodname>renderSubMenu()</methodname>
1512 will render the deepest sub menu of the active branch.
1516 Calling <methodname>renderSubMenu($container, $ulClass, $indent)</methodname>
1517 is equivalent to calling <methodname>renderMenu($container, $options)</methodname>
1518 with the following options:
1521 <programlisting language="php"><![CDATA[
1523 'ulClass' => $ulClass,
1524 'indent' => $indent,
1527 'onlyActiveBranch' => true,
1528 'renderParents' => false
1530 ]]></programlisting>
1532 <programlisting language="php"><![CDATA[
1534 echo $this->navigation()
1536 ->renderSubMenu(null, 'sidebar', 4);
1539 The output will be the same if 'FAQ' or 'Foo Server' is active:
1540 <ul class="sidebar">
1542 <a href="/products/server/faq">FAQ</a>
1545 <a href="/products/server/editions">Editions</a>
1548 <a href="/products/server/requirements">System Requirements</a>
1551 ]]></programlisting>
1554 <example id="zend.view.helpers.initial.navigation.menu.example4">
1555 <title>Rendering a menu with maximum depth</title>
1557 <programlisting language="php"><![CDATA[
1559 echo $this->navigation()
1565 <ul class="navigation">
1567 <a title="Go Home" href="/">Home</a>
1570 <a href="/products">Products</a>
1573 <a href="/products/server">Foo Server</a>
1576 <a href="/products/studio">Foo Studio</a>
1581 <a title="About us" href="/company/about">Company</a>
1584 <a href="/company/about/investors">Investor Relations</a>
1587 <a class="rss" href="/company/news">News</a>
1592 <a href="/community">Community</a>
1595 <a href="/community/account">My Account</a>
1598 <a class="external" href="http://forums.example.com/">Forums</a>
1603 ]]></programlisting>
1606 <example id="zend.view.helpers.initial.navigation.menu.example5">
1607 <title>Rendering a menu with minimum depth</title>
1609 <programlisting language="php"><![CDATA[
1611 echo $this->navigation()
1617 <ul class="navigation">
1619 <a href="/products/server">Foo Server</a>
1622 <a href="/products/server/faq">FAQ</a>
1625 <a href="/products/server/editions">Editions</a>
1628 <a href="/products/server/requirements">System Requirements</a>
1633 <a href="/products/studio">Foo Studio</a>
1636 <a href="/products/studio/customers">Customer Stories</a>
1639 <a href="/prodcts/studio/support">Support</a>
1644 <a href="/company/about/investors">Investor Relations</a>
1647 <a class="rss" href="/company/news">News</a>
1650 <a href="/company/news/press">Press Releases</a>
1653 <a href="/archive">Archive</a>
1658 <a href="/community/account">My Account</a>
1661 <a class="external" href="http://forums.example.com/">Forums</a>
1664 ]]></programlisting>
1667 <example id="zend.view.helpers.initial.navigation.menu.example6">
1668 <title>Rendering only the active branch of a menu</title>
1670 <programlisting language="php"><![CDATA[
1672 echo $this->navigation()
1674 ->setOnlyActiveBranch(true);
1678 <ul class="navigation">
1680 <a href="/products">Products</a>
1683 <a href="/products/server">Foo Server</a>
1686 <a href="/products/server/faq">FAQ</a>
1689 <a href="/products/server/editions">Editions</a>
1692 <a href="/products/server/requirements">System Requirements</a>
1699 ]]></programlisting>
1702 <example id="zend.view.helpers.initial.navigation.menu.example7">
1704 Rendering only the active branch of a menu with minimum depth
1707 <programlisting language="php"><![CDATA[
1709 echo $this->navigation()
1711 ->setOnlyActiveBranch(true)
1716 <ul class="navigation">
1718 <a href="/products/server">Foo Server</a>
1721 <a href="/products/server/faq">FAQ</a>
1724 <a href="/products/server/editions">Editions</a>
1727 <a href="/products/server/requirements">System Requirements</a>
1732 ]]></programlisting>
1735 <example id="zend.view.helpers.initial.navigation.menu.example8">
1737 Rendering only the active branch of a menu with maximum depth
1740 <programlisting language="php"><![CDATA[
1742 echo $this->navigation()
1744 ->setOnlyActiveBranch(true)
1749 <ul class="navigation">
1751 <a href="/products">Products</a>
1754 <a href="/products/server">Foo Server</a>
1757 <a href="/products/studio">Foo Studio</a>
1762 ]]></programlisting>
1765 <example id="zend.view.helpers.initial.navigation.menu.example9">
1767 Rendering only the active branch of a menu with maximum depth
1774 <programlisting language="php"><![CDATA[
1776 echo $this->navigation()
1778 ->setOnlyActiveBranch(true)
1779 ->setRenderParents(false)
1784 <ul class="navigation">
1786 <a href="/products/server">Foo Server</a>
1789 <a href="/products/studio">Foo Studio</a>
1792 ]]></programlisting>
1795 <example id="zend.view.helpers.initial.navigation.menu.example10">
1796 <title>Rendering a custom menu using a partial view script</title>
1799 This example shows how to render a custom menu using
1800 a partial vew script. By calling <methodname>setPartial()</methodname>,
1801 you can specify a partial view script that will be used
1802 when calling <methodname>render()</methodname>. When a partial is specified,
1803 the <methodname>renderPartial()</methodname> method will be called. This
1804 method will assign the container to the view with the key
1805 <code>container</code>.
1808 <para>In a layout:</para>
1810 <programlisting language="php"><![CDATA[
1811 $partial = array('menu.phtml', 'default');
1812 $this->navigation()->menu()->setPartial($partial);
1813 echo $this->navigation()->menu()->render();
1814 ]]></programlisting>
1816 <para>In application/modules/default/views/menu.phtml:</para>
1818 <programlisting language="php"><![CDATA[
1819 foreach ($this->container as $page) {
1820 echo $this->navigation()->menu()->htmlify($page), PHP_EOL;
1822 ]]></programlisting>
1824 <para>Output:</para>
1826 <programlisting language="php"><![CDATA[
1827 <a title="Go Home" href="/">Home</a>
1828 <a href="/products">Products</a>
1829 <a title="About us" href="/company/about">Company</a>
1830 <a href="/community">Community</a>
1831 ]]></programlisting>
1835 <sect4 id="zend.view.helpers.initial.navigation.sitemap">
1836 <title>Sitemap Helper</title>
1839 The Sitemap helper is used for generating <acronym>XML</acronym> sitemaps, as
1840 defined by the <ulink
1841 url="http://www.sitemaps.org/protocol.php">Sitemaps <acronym>XML</acronym>
1842 format</ulink>. Read more about <ulink
1843 url="http://en.wikipedia.org/wiki/Sitemaps">Sitemaps on Wikpedia</ulink>.
1847 By default, the sitemap helper uses
1848 <link linkend="zend.validate.sitemap">sitemap validators</link>
1849 to validate each element that is rendered. This can be disabled by
1850 calling <code>$helper->setUseSitemapValidators(false)</code>.
1855 If you disable sitemap validators, the custom properties (see table)
1856 are not validated at all.
1861 The sitemap helper also supports <ulink
1862 url="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">Sitemap XSD
1863 Schema</ulink> validation of the generated sitemap. This is disabled by default,
1864 since it will require a request to the Schema file. It can be
1866 <code>$helper->setUseSchemaValidation(true)</code>.
1869 <table id="zend.view.helpers.initial.navigation.sitemap.elements">
1870 <title>Sitemap XML elements</title>
1875 <entry>Element</entry>
1876 <entry>Description</entry>
1882 <entry><code>loc</code></entry>
1885 Absolute <acronym>URL</acronym> to page. An absolute
1886 <acronym>URL</acronym> will be generated by the helper.
1891 <entry><code>lastmod</code></entry>
1895 The date of last modification of the file, in <ulink
1896 url="http://www.w3.org/TR/NOTE-datetime">W3C Datetime</ulink>
1897 format. This time portion can be omitted if desired, and only use
1902 The helper will try to retrieve the
1903 <code>lastmod</code> value from the page's
1904 custom property <code>lastmod</code> if it
1905 is set in the page. If the value is not a
1906 valid date, it is ignored.
1912 <entry><code>changefreq</code></entry>
1916 How frequently the page is likely to change.
1917 This value provides general information to
1918 search engines and may not correlate exactly
1919 to how often they crawl the page. Valid
1924 <listitem><para>always</para></listitem>
1925 <listitem><para>hourly</para></listitem>
1926 <listitem><para>daily</para></listitem>
1927 <listitem><para>weekly</para></listitem>
1928 <listitem><para>monthly</para></listitem>
1929 <listitem><para>yearly</para></listitem>
1930 <listitem><para>never</para></listitem>
1934 The helper will try to retrieve the
1935 <code>changefreq</code> value from the page's
1936 custom property <code>changefreq</code> if it
1937 is set in the page. If the value is not
1938 valid, it is ignored.
1944 <entry><code>priority</code></entry>
1948 The priority of this <acronym>URL</acronym> relative to other
1949 <acronym>URL</acronym>s on your site. Valid values range from
1954 The helper will try to retrieve the
1955 <code>priority</code> value from the page's
1956 custom property <code>priority</code> if it
1957 is set in the page. If the value is not
1958 valid, it is ignored.
1967 Methods in the sitemap helper:
1973 <code>{get|set}FormatOutput()</code> gets/sets a flag
1974 indicating whether <acronym>XML</acronym> output should be formatted. This
1975 corresponds to the <code>formatOutput</code> property
1976 of the native <classname>DOMDocument</classname> class.
1978 <ulink url="http://php.net/domdocument">PHP: DOMDocument - Manual</ulink>.
1979 Default is <constant>FALSE</constant>.
1985 <code>{get|set}UseXmlDeclaration()</code> gets/sets a
1986 flag indicating whether the <acronym>XML</acronym> declaration should be
1987 included when rendering. Default is <constant>TRUE</constant>.
1993 <code>{get|set}UseSitemapValidators()</code> gets/sets a
1994 flag indicating whether sitemap validators should be
1995 used when generating the DOM sitemap. Default is
1996 <constant>TRUE</constant>.
2002 <code>{get|set}UseSchemaValidation()</code> gets/sets a
2003 flag indicating whether the helper should use <acronym>XML</acronym> Schema
2004 validation when generating the DOM sitemap. Default is
2005 <constant>FALSE</constant>. If <constant>TRUE</constant>.
2011 <code>{get|set}ServerUrl()</code> gets/sets server <acronym>URL</acronym>
2012 that will be prepended to non-absolute <acronym>URL</acronym>s in the
2013 <methodname>url()</methodname> method. If no server <acronym>URL</acronym> is
2014 specified, it will be determined by the helper.
2020 <methodname>url()</methodname> is used to generate absolute
2021 <acronym>URL</acronym>s to pages.
2027 <methodname>getDomSitemap()</methodname> generates a DOMDocument
2028 from a given container.
2033 <example id="zend.view.helpers.initial.navigation.sitemap.example">
2034 <title>Rendering an XML sitemap</title>
2037 This example shows how to render an <acronym>XML</acronym> sitemap based
2038 on the setup we did further up.
2041 <programlisting language="php"><![CDATA[
2042 // In a view script or layout:
2047 ->setFormatOutput(true); // default is false
2049 // other possible methods:
2050 // ->setUseXmlDeclaration(false); // default is true
2051 // ->setServerUrl('http://my.otherhost.com');
2052 // default is to detect automatically
2055 echo $this->navigation()->sitemap();
2056 ]]></programlisting>
2059 Notice how pages that are invisible or pages with
2060 <acronym>ACL</acronym> roles incompatible with the view helper are filtered
2064 <programlisting language="xml"><![CDATA[
2065 <?xml version="1.0" encoding="UTF-8"?>
2066 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2068 <loc>http://www.example.com/</loc>
2071 <loc>http://www.example.com/products</loc>
2074 <loc>http://www.example.com/products/server</loc>
2077 <loc>http://www.example.com/products/server/faq</loc>
2080 <loc>http://www.example.com/products/server/editions</loc>
2083 <loc>http://www.example.com/products/server/requirements</loc>
2086 <loc>http://www.example.com/products/studio</loc>
2089 <loc>http://www.example.com/products/studio/customers</loc>
2092 <loc>http://www.example.com/prodcts/studio/support</loc>
2095 <loc>http://www.example.com/company/about</loc>
2098 <loc>http://www.example.com/company/about/investors</loc>
2101 <loc>http://www.example.com/company/news</loc>
2104 <loc>http://www.example.com/company/news/press</loc>
2107 <loc>http://www.example.com/archive</loc>
2110 <loc>http://www.example.com/community</loc>
2113 <loc>http://www.example.com/community/account</loc>
2116 <loc>http://forums.example.com/</loc>
2119 ]]></programlisting>
2122 Render the sitemap using no <acronym>ACL</acronym> role (should filter out
2123 /community/account):
2126 <programlisting language="php"><![CDATA[
2127 echo $this->navigation()
2129 ->setFormatOutput(true)
2131 ]]></programlisting>
2133 <programlisting language="xml"><![CDATA[
2134 <?xml version="1.0" encoding="UTF-8"?>
2135 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2137 <loc>http://www.example.com/</loc>
2140 <loc>http://www.example.com/products</loc>
2143 <loc>http://www.example.com/products/server</loc>
2146 <loc>http://www.example.com/products/server/faq</loc>
2149 <loc>http://www.example.com/products/server/editions</loc>
2152 <loc>http://www.example.com/products/server/requirements</loc>
2155 <loc>http://www.example.com/products/studio</loc>
2158 <loc>http://www.example.com/products/studio/customers</loc>
2161 <loc>http://www.example.com/prodcts/studio/support</loc>
2164 <loc>http://www.example.com/company/about</loc>
2167 <loc>http://www.example.com/company/about/investors</loc>
2170 <loc>http://www.example.com/company/news</loc>
2173 <loc>http://www.example.com/company/news/press</loc>
2176 <loc>http://www.example.com/archive</loc>
2179 <loc>http://www.example.com/community</loc>
2182 <loc>http://forums.example.com/</loc>
2185 ]]></programlisting>
2188 Render the sitemap using a maximum depth of 1.
2191 <programlisting language="php"><![CDATA[
2192 echo $this->navigation()
2194 ->setFormatOutput(true)
2196 ]]></programlisting>
2198 <programlisting language="xml"><![CDATA[
2199 <?xml version="1.0" encoding="UTF-8"?>
2200 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2202 <loc>http://www.example.com/</loc>
2205 <loc>http://www.example.com/products</loc>
2208 <loc>http://www.example.com/products/server</loc>
2211 <loc>http://www.example.com/products/studio</loc>
2214 <loc>http://www.example.com/company/about</loc>
2217 <loc>http://www.example.com/company/about/investors</loc>
2220 <loc>http://www.example.com/company/news</loc>
2223 <loc>http://www.example.com/community</loc>
2226 <loc>http://www.example.com/community/account</loc>
2229 <loc>http://forums.example.com/</loc>
2232 ]]></programlisting>
2236 <title>UTF-8 encoding used by default</title>
2239 By default, Zend Framework uses <acronym>UTF-8</acronym> as its default encoding,
2240 and, specific to this case, <classname>Zend_View</classname> does as well. Character
2241 encoding can be set differently on the view object itself using the
2242 <methodname>setEncoding()</methodname> method (or the the
2243 <varname>encoding</varname> instantiation parameter). However, since
2244 <classname>Zend_View_Interface</classname> does not define accessors for encoding,
2245 it's possible that if you are using a custom view implementation with the Dojo view
2246 helper, you will not have a <methodname>getEncoding()</methodname> method, which is
2247 what the view helper uses internally for determining the character set in which to
2252 If you do not want to utilize <acronym>UTF-8</acronym> in such a situation, you will
2253 need to implement a <methodname>getEncoding()</methodname> method in your custom
2254 view implementation.
2259 <sect4 id="zend.view.helpers.initial.navigation.navigation">
2260 <title>Navigation Helper</title>
2263 The Navigation helper is a proxy helper
2264 that relays calls to other navigational helpers. It can be
2265 considered an entry point to all navigation-related view tasks.
2266 The aforementioned navigational helpers are in the namespace
2267 <classname>Zend_View_Helper_Navigation</classname>, and would thus require
2268 the path <code>Zend/View/Helper/Navigation</code> to be added as
2269 a helper path to the view. With the proxy helper residing in the
2270 <classname>Zend_View_Helper</classname> namespace, it will always be
2271 available, without the need to add any helper paths to the view.
2275 The Navigation helper finds other helpers that implement the
2276 <classname>Zend_View_Helper_Navigation_Helper</classname>
2277 interface, which means custom view helpers can also be proxied.
2278 This would, however, require that the custom helper path is added
2283 When proxying to other helpers, the Navigation helper can inject
2284 its container, <acronym>ACL</acronym>/role, and translator. This means that you
2285 won't have to explicitly set all three in all navigational
2286 helpers, nor resort to injecting by means of
2287 <classname>Zend_Registry</classname> or static methods.
2293 <methodname>findHelper()</methodname> finds the given helper,
2294 verifies that it is a navigational helper, and injects
2295 container, <acronym>ACL</acronym>/role and translator.
2301 <code>{get|set}InjectContainer()</code> gets/sets a flag
2302 indicating whether the container should be injected to
2303 proxied helpers. Default is <constant>TRUE</constant>.
2309 <code>{get|set}InjectAcl()</code> gets/sets a flag
2310 indicating whether the <acronym>ACL</acronym>/role should be injected to
2311 proxied helpers. Default is <constant>TRUE</constant>.
2317 <code>{get|set}InjectTranslator()</code> gets/sets a flag
2318 indicating whether the translator should be injected to
2319 proxied helpers. Default is <constant>TRUE</constant>.
2325 <code>{get|set}DefaultProxy()</code> gets/sets the default
2326 proxy. Default is <code>'menu'</code>.
2332 <methodname>render()</methodname> proxies to the render method of