Zend Framework: Navigation XML and duplicate page elements

Posted by jakenoble on Stack Overflow See other posts from Stack Overflow or by jakenoble
Published on 2011-03-19T00:08:40Z Indexed on 2011/03/19 0:10 UTC
Read the original article Hit count: 125

Filed under:
|
|
|

Hi

In XML I'd normal expect the following to be perfectly valid and navigable in a meaningful way using something like PHP's DomDocument:

<?xml version="1.0" encoding="UTF-8"?>
<configdata>    
  <page>
    <name>Home</name>
  </page>
  <page>
    <name>Log in</name>
  </page>
</configdata>

This is not the case when using Zend_Navigation. Each <page> element needs to have a unique name, so you would need to do:

<?xml version="1.0" encoding="UTF-8"?>
<configdata>    
  <page_home>
    <name>Home</name>
  </page_home>
  <page_log_in>
    <name>Log in</name>
  </page_log_in>
</configdata>

This works, but is very annoying. I'd much rather have multiple page elements which can have the same name and can be easily copy and pasted when creating many pages for navigation.

Why does each one need a unique name?

Is there a way of not having to have a unique name?

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml