Hi I'm trying to show the lastest news item [doctype NewsItem] on all pages, but its currently not working and if possible show a featured news item is the they dont want the lastest..
<xsl:for-eachselect="$currentPage/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']">
only if all the news items are actually below the node that you are using this script on. If they are not you should probably introduce some variable like this: <xsl:variable name="newsItemsRoot" value="umbraco.library:GetXmlNodeById(your-root-node-id)" />, then you can use
<xsl:for-eachselect="$newsItemsRoot/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']">
to get a list of all news items.
If your client wants a favourite news item to be shown you need to wrap this with a choose statement, check if a fav news item is set and if so use that instead.
get featured news item or default to latest item
Hi I'm trying to show the lastest news item [doctype NewsItem] on all pages, but its currently not working and if possible show a featured news item is the they dont want the lastest..
my code looks like this
Every section i have this marco on is blank
Hi Ivor,
try the following:
instead of
use
That orders the news items by their creation date in descending order.
Then use position() = 1 in your test, the index starts at 1 (and not 0, so <1 will never be true).
Instead of
you should use
to get the name of the node in Umbraco.
You can use
only if all the news items are actually below the node that you are using this script on. If they are not you should probably introduce some variable like this: <xsl:variable name="newsItemsRoot" value="umbraco.library:GetXmlNodeById(your-root-node-id)" />, then you can use
to get a list of all news items.
If your client wants a favourite news item to be shown you need to wrap this with a choose statement, check if a fav news item is set and if so use that instead.
Hope that helps,
Sascha
Hi Sacha, for some weird reason my posts was duplicated. Matt Brailsofrd help me with my problem in the other post
No worries, I've seen that 10 seconds after I posted this. ;)
is working on a reply...