I'd agree with Rich's approach to the content node structure. In addition, you could use the 'List Subpages from Current Page' XSLT template (with a little tweaking) to create the list you need.
Following on from Rich's post, you will need to create a template for your Employees list which uses an XSLT macro to loop through all child employee nodes. You can use the Runway faqListCategories macro as a stating point:
<xsl:choose> <xsl:when test="count($currentPage/employee)<=0"> <div id="NoComments"> There are no child nodes of doctype 'employee' ... div> xsl:when> <xsl:otherwise>
FYI post has trashed some of the leading "<" brackets from some of the tags - if you have Runway installed you can make a copy of faqListCategories and modify accordingly.. Alternatively you can start from fresh and use one of the built in starter fils - in this case "List all sub pages by document type
<!-- Input the documenttype you want here --> <xsl:variable name="documentTypeAlias" select="string('employee')"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:for-each select="$currentPage/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']">
<h3><xsl:value-of select="@nodeName"/></h3> <p>Other employee node properties go here</p> </xsl:for-each> </ul>
content page
hi, i want a page which like as-
I have create a template (employee template) and a document type for name, mobile, email etc, which can add a single employee info.
and using this template how can i add many employee info.
pls help me any one.
touhid
Hey,
You can add an employee DocType and then loop through them.
So your structure might be
Content
Home
Employees (Display all Employees listed below here)
- Employee 1
- Employee 2
- Employee 3
Rich
I'd agree with Rich's approach to the content node structure. In addition, you could use the 'List Subpages from Current Page' XSLT template (with a little tweaking) to create the list you need.
Tom
thnks for quick reply. i have add a employee DocType and content section as -
Employee
- Employee 1
- Employee 2
- Employee 3
But i cant understand looping them and what ill do?
Hi Touhid,
Following on from Rich's post, you will need to create a template for your Employees list which uses an XSLT macro to loop through all child employee nodes. You can use the Runway faqListCategories macro as a stating point:
version="1.0" encoding="UTF-8"?>
DOCTYPE xsl:stylesheet [
ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:variable name="title" select="/macro/title"/>
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="count($currentPage/employee)<=0">
<div id="NoComments">
There are no child nodes of doctype 'employee' ...
div>
xsl:when>
<xsl:otherwise>
<xsl:for-each select="$currentPage/employee">
<h3>
<xsl:value-of select="employeeName"/>
h3>
<
xsl:value-of select="jobTitle" disable-output-escaping="yes"/>xsl:for-each>
xsl:otherwise>
xsl:choose>
xsl:template>
xsl:stylesheet>
Hopefully that will get you started. There are some useful videos at umbraco.tv that discuss creating these type of XSLT's
http://umbraco.org/help-and-support/video-tutorials/introduction-to-umbraco/sitebuilder-introduction/creating-your-first-xslt-macro
FYI post has trashed some of the leading "<" brackets from some of the tags - if you have Runway installed you can make a copy of faqListCategories and modify accordingly.. Alternatively you can start from fresh and use one of the built in starter fils - in this case "List all sub pages by document type
<!-- Input the documenttype you want here -->
<xsl:variable name="documentTypeAlias" select="string('employee')"/>
<xsl:template match="/">
<!-- The fun starts here -->
<ul>
<xsl:for-each select="$currentPage/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']">
<h3><xsl:value-of select="@nodeName"/></h3>
<p>Other employee node properties go here</p>
</xsl:for-each>
</ul>
</xsl:template>
sory, i cant do it. please help me in details.
is working on a reply...