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: 657
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 » Wed Apr 29, 2015 1:26 pm

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: 19288
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

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

Post by Pablo » Wed Apr 29, 2015 2:21 pm

The 'TITLE' element in the XML will be replaced by the menu name from the page properties.

User avatar
Patrik iden
 
 
Posts: 657
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 » Wed Apr 29, 2015 3:12 pm

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: 19288
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

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

Post by Pablo » Wed Apr 29, 2015 5:29 pm

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: 657
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 » Wed Apr 29, 2015 5:40 pm

Thank you for this. It works now.

User avatar
Patrik iden
 
 
Posts: 657
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 » Tue May 05, 2015 7:39 pm

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

Who is online

Users browsing this forum: No registered users and 1 guest