Andy, can you provide the XSLT that produces the above output? It's easier for us to modify/help with what you currently have. To address the *specific* type that you are looking for, please see Dirks post that talks about 'nodeTypeAlias'. The nodeTypeAlias points to the name of a specific DocumentType that you would have setup in the 'Settings' section. It is necessary/useful to separate your various types of content into DocumentTypes. Not only to distinguish between them, but also to be able to specify different attributes for different types.
For example, a 'standard' page/document type would in all likelyhood only have
- Page Heading - Body Text
Whereas your news document type would probably have things like:
- Date - Title - Description - Summary - ...
Not sure if you've gotten this far already. If you have, please disregard.
My code snippet should really do the trick, as it selects all nodes ('//' selector') regardless of their level, after having traversed upwards until it finds a node with level = 1, but you should restructure your site to only have a single top level node (in your case, that would be 'Home'). It's best practice to have a single top level node ('Home') and put all other stuff on a lower level (as child nodes from 'Home'). If you still want to use your approach, you'd need better create a macro parameter (alias="newsNode", type = content picker) and use that parameter value in your xslt:
What Dirk is suggestion are both valid. In case any of them don't work for you (for whatever reason) you should alos consider using GetXmlAll() (one of my personal favorites). So, it would look something like this:
This snippet also ensures that it strips out any nodes that are maked to be hidden via the standard umbracoNaviHide property. Then, to loop over the data you would do something like:
Trying to create a news section...
Hi guys,
I'm new to umbraco and having a *lot* of problems with it, even after watching the videos i find it very, very difficult to navigate.
I'm trying to create a news section, this would be a seperate section but also would pull the top XX stories into the front page.
I created the templates, added the pages and content but can't find how to pull the pages into the homepage.
Can anyone point me in the right direction ?
hookbeak,
Ok, let's try using an example (I'll have to make some assumptions here, up to you to substitute with correct names...)
-Go to developer section, create an xslt file (check to create macro) 'News', choose empty template.
-Paste following code snippet after "Fun is starting here"
(Must subsititute 'News' with the alias of a news item document type)
-Save template
-Expand the macro node and select 'News' macro and verify whether the macro references the 'News' xslt.
-Go to your template that will render the homepage and use the dialog to insert a macro (icon in menu bar of template editor)
-Select 'News' from the list.
-Save template, browse to your homepage and you should get a list of pages that are news items
If still unclear or want more info, let us know.
Hope this helps.
Regards,
/Dirk
hi dirk,
Is it possible to have umbraco show a list of a *specific* node ?
i have this kind of layout :
home
|----------- NEWS
| |-Newsitem1
| |-Newsitem2
|----------- Other section
|----------- Third Section
And the macro is returning
NEWS
OtherSection
ThirdSection
instead of the
NewsItem1
Newsitem2
that i'd like
Andy
Actually, ignore my last post - i'm being dumb !
Andy, can you provide the XSLT that produces the above output? It's easier for us to modify/help with what you currently have. To address the *specific* type that you are looking for, please see Dirks post that talks about 'nodeTypeAlias'. The nodeTypeAlias points to the name of a specific DocumentType that you would have setup in the 'Settings' section. It is necessary/useful to separate your various types of content into DocumentTypes. Not only to distinguish between them, but also to be able to specify different attributes for different types.
For example, a 'standard' page/document type would in all likelyhood only have
- Page Heading
- Body Text
Whereas your news document type would probably have things like:
- Date
- Title
- Description
- Summary
- ...
Not sure if you've gotten this far already. If you have, please disregard.
Cheers,
Nik
hi guys,
thanks for the help so far :
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level = 1]//node [@nodeTypeAlias = 'News Item']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
can anyone tell me how to change this XSL so that it would pick up all 'NewsItem' templated pages independent of location:
My structure is like this:
-home page
- News
|-News1
|-News2
They are appearing on page "news", but i can't pull them into "home page " as well.....
My code snippet should really do the trick, as it selects all nodes ('//' selector') regardless of their level, after having traversed upwards until it finds a node with level = 1, but you should restructure your site to only have a single top level node (in your case, that would be 'Home'). It's best practice to have a single top level node ('Home') and put all other stuff on a lower level (as child nodes from 'Home'). If you still want to use your approach, you'd need better create a macro parameter (alias="newsNode", type = content picker) and use that parameter value in your xslt:
and change xslt for-each to use this variable:
(Might get an error when saving, just for now, check the 'Skip errors' box)
Macro call in the template will need some mods to include the new parameter
Hope this helps.
Regards,
/Dirk
What Dirk is suggestion are both valid. In case any of them don't work for you (for whatever reason) you should alos consider using GetXmlAll() (one of my personal favorites). So, it would look something like this:
This snippet also ensures that it strips out any nodes that are maked to be hidden via the standard umbracoNaviHide property. Then, to loop over the data you would do something like:
What this will allow you to do is use this snippet ANYWHERE in the site as it is not dependant on traversing the XML based on $currentPage.
Hope this helps.
-- Nik
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.