I am completely new to Umbraco, but the it seems to be a great product. However, I've been playing with the macros but I am not able to make it work properly and I need some help.
I have a page with 2 sub-pages. The parent page is one type of template, and the sub-pages are a different kind of template. Structure like this:
- Frontpage_News (template 1)
- NewsPage1 (template 2)
- NewsPage 2 (template 2)
I created a XSLT/Macro that will loop through the sub-pages of the parent pages, and the macro is put on the parent template (template 1). The XSLT looks like this:
for each loop I want the conrent of the alias 'mainContent' (which is a field on the template of the sub-pages) to be printed. However that returns no value. The <xsl:value-of select="@nodeName"/> returns the nodename correctly, and I also tried the <xsl:value-of select="."/> which prints the content of the 'mainContent'-field.
It looks like the problem is you are referring to your mainContent field using the old XML schema (it was changed in v4.5). The old schema stored your properties in data nodes, now they are stored in nodes named with the alias. So this should work:
Documentation has always been an issue, but it's getting much better.
Your best bet might be to purchase the Umbraco User's Guide, it's a book that was just published recently that should help you get started.
There's also umbraco.tv, which has a few free videos and some more in-depth ones with a subscription. It's definately a good investment.
Other than that, there is the wiki, which has a lot of "articles" written by the community. For example, here's a few pages written about the New Schema (which caused your issue) and some the XSLT section.
And of course, Umbraco has a very friendly and helpful community, so if you post any issues you run into on the forums, there will be people eager and glad to help :) Once you get past the learning curve you'll love it!
value-of select returns no value
Hi all,
I am completely new to Umbraco, but the it seems to be a great product. However, I've been playing with the macros but I am not able to make it work properly and I need some help.
I have a page with 2 sub-pages. The parent page is one type of template, and the sub-pages are a different kind of template. Structure like this:
- Frontpage_News (template 1)
- NewsPage1 (template 2)
- NewsPage 2 (template 2)
I created a XSLT/Macro that will loop through the sub-pages of the parent pages, and the macro is put on the parent template (template 1). The XSLT looks like this:
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<tr>
<td>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
</td>
</tr>
<tr>
<td>
<xsl:value-of select="."/> <br/>
<xsl:value-of select="data[@alias='mainContent']"/><br/>
</td>
</tr>
</xsl:for-each>
for each loop I want the conrent of the alias 'mainContent' (which is a field on the template of the sub-pages) to be printed. However that returns no value. The <xsl:value-of select="@nodeName"/> returns the nodename correctly, and I also tried the <xsl:value-of select="."/> which prints the content of the 'mainContent'-field.
Help highly appreciated.
Thank you.
Eirik
Hi Eirik,
It looks like the problem is you are referring to your mainContent field using the old XML schema (it was changed in v4.5). The old schema stored your properties in data nodes, now they are stored in nodes named with the alias. So this should work:
Hope this helps,
Tom
That works great, Tom. Thank you very much :-)
I am a little bit confused about the documentation for Umbraco. Is there a documentation file (like PDF) where I can find these kind of answers?
Eirik
Hi,
Documentation has always been an issue, but it's getting much better.
Your best bet might be to purchase the Umbraco User's Guide, it's a book that was just published recently that should help you get started.
There's also umbraco.tv, which has a few free videos and some more in-depth ones with a subscription. It's definately a good investment.
Other than that, there is the wiki, which has a lot of "articles" written by the community. For example, here's a few pages written about the New Schema (which caused your issue) and some the XSLT section.
And of course, Umbraco has a very friendly and helpful community, so if you post any issues you run into on the forums, there will be people eager and glad to help :) Once you get past the learning curve you'll love it!
-Tom
is working on a reply...