How to use Syncronize with site manager in own menu extensio

This section can be used to submit suggestions for Extension Builder.
Note that this section is not monitored for support.
Forum rules
This forum section can be used to submit suggestions for Extension Builder.
Note that this section is not monitored for support.
Post Reply
User avatar
Patrik iden
 
 
Posts: 479
Joined: Wed Mar 24, 2010 9:07 pm
Location: Sweden

How to use Syncronize with site manager in own menu extensio

Post by Patrik iden »

Hellow WWB support i have question regarding Syncronize with site manager when adding menu items in my own Menu Extension.
If i understand this correct by looking at eg, your css menu, when Syncronize with site manager this adds the links and the "Menu names" to the menu. It is the Menu names Not the Title that gets added right?
But this is not working in my own Extensions, is there a way to fix this?

Thank you.
User avatar
Pablo
 
Posts: 21508
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to use Syncronize with site manager in own menu exte

Post by Pablo »

The 'TITLE' element in the XML will be replaced by the menu name from the page properties.
User avatar
Patrik iden
 
 
Posts: 479
Joined: Wed Mar 24, 2010 9:07 pm
Location: Sweden

Re: How to use Syncronize with site manager in own menu exte

Post by Patrik iden »

support wrote:The 'TITLE' element in the XML will be replaced by the menu name from the page properties.
OK i have this code in the XML, so wy don't i get the menu name in the manu?

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="menu" />
</xsl:template>
<xsl:template name="menu">
<ul>
<xsl:apply-templates select="MENU/ITEM" />
</ul>
</xsl:template>
<xsl:template match="ITEM">
<li>
<a href="{URL}"><xsl:value-of select="TITLE"/></a>
<xsl:if test="ITEM">
<ul>
<xsl:apply-templates select="ITEM"/>
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
I'v used this code from the Extension builder Example files and use in my own. But the Menu names are not show in the original Example file either?
User avatar
Pablo
 
Posts: 21508
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to use Syncronize with site manager in own menu exte

Post by Pablo »

For the synchronize to work the xml should look like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="menu" />
</xsl:template>
<xsl:template name="menu">
<ul>
<xsl:apply-templates select="MENU/ITEM" />
</ul>
</xsl:template>
<xsl:template match="ITEM">
<li>
<a href="{URL}"><xsl:value-of select="NAME"/><xsl:value-of select="TITLE"/></a>
<xsl:if test="ITEM">
<ul>
<xsl:apply-templates select="ITEM"/>
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
User avatar
Patrik iden
 
 
Posts: 479
Joined: Wed Mar 24, 2010 9:07 pm
Location: Sweden

Re: How to use Syncronize with site manager in own menu exte

Post by Patrik iden »

Thank you for this. It works now.
User avatar
Patrik iden
 
 
Posts: 479
Joined: Wed Mar 24, 2010 9:07 pm
Location: Sweden

Re: How to use Syncronize with site manager in own menu exte

Post by Patrik iden »

Hello i have this HTML menu how should the xsl file look like?

Code: Select all

<!-- Nav -->
				<nav class="nav">
					<ul class="nav-list">
						<li class="nav-item">
							<a href="?=home">Home</a>
							<ul class="nav-submenu">
								<li class="nav-submenu-item">
									<a href="?=submenu-1">Submenu item 1</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-2">Submenu item 2</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-3">Submenu item 3</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-4">Submenu item 4</a>
								</li>
							</ul>
						</li>
						<li class="nav-item">
							<a href="?=about">About</a>
						</li>
						<li class="nav-item">
							<a href="?=services">Services</a>
							<ul class="nav-submenu">
								<li class="nav-submenu-item">
									<a href="?=submenu-1">Submenu item 1</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-2">Submenu item 2</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-3">Submenu item 3</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-4">Submenu item 4</a>
								</li>
							</ul>
						</li>
						<li class="nav-item">
							<a href="?=portfolio">Portfolio</a>
						</li>
						<li class="nav-item">
							<a href="?=testimonials">Testimonials</a>
						</li>
						<li class="nav-item">
							<a href="?=contact">Contact</a>
						</li>
					</ul>
				</nav>
				<!-- /Nav -->
XSL file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="menu" />
</xsl:template>
<xsl:template name="menu">
<ul class="nav-list>
<xsl:apply-templates select="MENU/ITEM" />
</ul>
</xsl:template>
<xsl:template match="ITEM">
<li class="nav-item">
<a href="{URL}"><xsl:value-of select="NAME"/><xsl:value-of select="TITLE"/></a>
<xsl:if test="ITEM">
<ul class="nav-submenu">
<li class="nav-submenu-item">
<xsl:apply-templates select="ITEM"/>
</ul>
</xsl:if>
</li>
</li>
</xsl:template>
</xsl:stylesheet>
Thank you.
Post Reply