Is it possible to display both "Publish at" or "Remove at" properties? Lets say i want them to unpublished a node automatically at a specific date and want the "Remove at" value to display on my page.
It's possible, but not within the context of XSLT. If you're using XSLT you'll need to create extensions for it since the Node doesn't contain these values by default. The Document object does though :-)
Lee i have installed the package but somehow didnt select the "Nodes" from the list. Is there a way of getting back to that screen or i need to remove the package completely and reinstall it?
If you aren't using the Dates one, then sure, remove it. Otherwise you can add the Nodes one straight after it - no problem in having multiple entries.
Doh! There's been so much development on uComponents recently, that I've forgotten when features where introduced! Try installing the latest v2.2 beta: http://ucomponents.codeplex.com/releases/view/70364 - you can install it over the top of v2.1.
Just tested this and found that GetExpireDate worked fine, but GetReleaseDate didn't (reason being that once a scheduled document has been published, the "publish at" is cleared).
Double check that the "remove at" date is set for the document. If it empty, then it will display as "01/01/0001 00:00:00"
Yes I double checked, I have the following date 2011-10-20 08:24 entered in my "Remove at" properties but still getting the same output "1/1/0001 12:00:00 AM".
Am using this in my xslt, but in the listing its not working
Lee any thoughts why this is not working in my XSLT ? When rendering the it using XSLT Macro engine in template i works just fine but not where am listing the nodes using xslt.
Why not create an event handler that copies the values to custom fields on save? That way they are easily accessible via standard methods and you won't have the extra load of going through the Document model (which will hit the database).
Thanks for the response but am not sure of going for an event handler since i basically just want to use the "Remove at" functionality in umbraco and make the Display the date and have the node unpublished automatically.
but here again am getting the same output. 1/1/0001 12:00:00 AM
Just for the record, i have a list of page with some values and displaying those in a page where you will have the nodeName, ShortDes and a ExpirationDate.
When displaying the list i cant get the ExpirationDate as should. Then i tried adding this to my template page to see what was the output
With my last reply, did you compare the values of $currentPage/@id - need to confirm that you are dealing with the same page/node? (and not using it inside a loop?)
Publish at & Remove at
Is it possible to display both "Publish at" or "Remove at" properties? Lets say i want them to unpublished a node automatically at a specific date and want the "Remove at" value to display on my page.
Hi Fuji,
It's possible, but not within the context of XSLT. If you're using XSLT you'll need to create extensions for it since the Node doesn't contain these values by default. The Document object does though :-)
/ Bo
Hi Fuji,
There isn't a way out-of-the-box.
In uComponents, we have a couple of methods in the XsltExtensions for Nodes: GetReleaseDate and GetExpireDate.
Cheers, Lee.
.. or use the absolute-must-have package, uComponents! ;-)
Thanks for both @Bo and @Lee for the response. Ok ill install uComponents and see how it works.
Lee i have installed the package but somehow didnt select the "Nodes" from the list. Is there a way of getting back to that screen or i need to remove the package completely and reinstall it?
Hi Fuji,
There is a way to get the post-install screen back up, details here:
All it does is add the following to your /config/xsltExtensions.config file
Cheers, Lee.
So basically i cant just remove
and add this instead
If you aren't using the Dates one, then sure, remove it. Otherwise you can add the Nodes one straight after it - no problem in having multiple entries.
Cheers, Lee.
I did change the config to
But still when using ucomponents.nodes i cant find the GetReleaseDate and GetExpireDate.
Doh! There's been so much development on uComponents recently, that I've forgotten when features where introduced! Try installing the latest v2.2 beta: http://ucomponents.codeplex.com/releases/view/70364 - you can install it over the top of v2.1.
Do i need to include this in my stylesheet as well
Cant get it working when using
Hi Fuji,
You can remove the "ucomponents.dates" if you want to. It will cause no harm if you leave it in there.
With the GetReleaseDate call, just use the node id, like so:
Cheers, Lee.
Even this it wont let me save my xslt,
I have tried a few of your tutorials, but i think i must be missing something coz am getting this error
just by simply using
<umbraco:Macro runat="server" language="XSLT">
<xsl:value-of select="$currentPage/@nodeName"/>
</umbraco:Macro>
Error loading MacroEngine script (file: )
Finally got my XSLT to save by adding to my Stylesheet.
however the output is not correct, am not getting the right Removal Date but this instead
1/1/0001 12:00:00 AM
Any Advise??
//fuji
Any suggestion on this?
Hi Fuji,
Just tested this and found that GetExpireDate worked fine, but GetReleaseDate didn't (reason being that once a scheduled document has been published, the "publish at" is cleared).
Double check that the "remove at" date is set for the document. If it empty, then it will display as "01/01/0001 00:00:00"
Cheers, Lee.
Hi Lee,
Yes I double checked, I have the following date 2011-10-20 08:24 entered in my "Remove at" properties but still getting the same output "1/1/0001 12:00:00 AM".
Am using this in my xslt, but in the listing its not working
<xsl:value-of select="ucomponents.nodes:GetExpireDate($currentPage/@id)" />
However I ran some test and installed XSLT macro engine to render it in my template instead and found like
<umbraco:Macro runat="server" language="xslt">
<xsl:value-of select="umbraco.library:FormatDateTime(ucomponents.nodes:GetExpireDate($currentPage/@id), 'dd MMM yyy')"/>
</umbraco:Macro>
and gets the right output "20 Oct 2011 ".
//fuji
Lee any thoughts why this is not working in my XSLT ? When rendering the it using XSLT Macro engine in template i works just fine but not where am listing the nodes using xslt.
Why not create an event handler that copies the values to custom fields on save? That way they are easily accessible via standard methods and you won't have the extra load of going through the Document model (which will hit the database).
Hi Dan,
Thanks for the response but am not sure of going for an event handler since i basically just want to use the "Remove at" functionality in umbraco and make the Display the date and have the node unpublished automatically.
//fuji
Any ucomponents fans has any suggestion why this is not working in xslt but when works when used in template making use of XSLT macro engine??
Hi Fuji,
Obviously there is something different going on between both Macros.
Could you try to compare the values of $currentPage/@id? To make sure that you are dealing with the same content page/node.
Thanks, Lee.
Hi Lee,
I tried this as well
<xmp><xsl:copy-of select="ucomponents.nodes:GetExpireDate($currentPage/@id)"/>xmp>
but here again am getting the same output. 1/1/0001 12:00:00 AM
Just for the record, i have a list of page with some values and displaying those in a page where you will have the nodeName, ShortDes and a ExpirationDate.
When displaying the list i cant get the ExpirationDate as should. Then i tried adding this to my template page to see what was the output
<umbraco:Macro runat="server" language="xslt"> <xsl:value-of select="umbraco.library:FormatDateTime(ucomponents.nodes:GetExpireDate($currentPage/@id), 'dd MMM yyy')"/> </umbraco:Macro>
So basically when i click on the nodeName from the list to see the full description of the content i get the right output.
Hi Fuji,
With my last reply, did you compare the values of $currentPage/@id - need to confirm that you are dealing with the same page/node? (and not using it inside a loop?)
Thanks, Lee.
Hi Lee,
Yes am using it in a loop when i click on the related page i get the right "Date".
Here is a preview of my source code
<xsl:for-each select="$sourceXml">
<xsl:sort select="current()/@updateDate" order="descending"/>
<div class="ref"><xsl:value-of select="umbraco.library:GetDictionaryItem('Reference')" /><br/><span class="sup"><xsl:value-of select="careerRefNum" disable-output-escaping="yes"/> </span></div>
<div class="date"><xsl:value-of select="umbraco.library:GetDictionaryItem('Closing Date')"/><br/><span class="sup"><xsl:value-of select="ucomponents.nodes:GetExpireDate($currentPage/@id)" /> </span></div>
<div class="details"> <br/> <a href="{umbraco.library:NiceUrl(@id)}">View Details</a> </div>
</xsl:for-each>
Thinking that you need to remove the $currentPage param? and only use the @id
Cheers, Lee
Got it working ...
<xsl:value-of select="umbraco.library:FormatDateTime(ucomponents.nodes:GetExpireDate(@id), 'dd MMM yyy')"/>
thanks Lee
Woo! Glad that we go there in the end!
is working on a reply...