Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 17, 2011 @ 19:20
    Fuji Kusaka
    0

    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.

     

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Oct 17, 2011 @ 19:44
    Bo Damgaard Mortensen
    2

    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

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 17, 2011 @ 19:44
    Lee Kelleher
    1

    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.

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Oct 17, 2011 @ 19:48
    Bo Damgaard Mortensen
    0

    .. or use the absolute-must-have package, uComponents! ;-)

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 17, 2011 @ 19:51
    Fuji Kusaka
    0

    Thanks for both @Bo and  @Lee for the response. Ok ill install uComponents and see how it works.

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 17, 2011 @ 20:24
    Fuji Kusaka
    0

    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?

     

     

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 17, 2011 @ 20:26
    Lee Kelleher
    0

    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

    <ext assembly="uComponents.Core" type="uComponents.Core.XsltExtensions.Nodes" alias="ucomponents.nodes" />

    Cheers, Lee.

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 17, 2011 @ 20:28
    Fuji Kusaka
    0

    So basically i cant just remove

    <ext assembly="uComponents.Core" type="uComponents.Core.XsltExtensions.Dates" alias="ucomponents.dates">
      </ext>

    and add this instead

    <extassembly="uComponents.Core"type="uComponents.Core.XsltExtensions.Nodes"alias="ucomponents.nodes"/>
  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 17, 2011 @ 20:37
    Lee Kelleher
    0

    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.

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 17, 2011 @ 20:38
    Fuji Kusaka
    0

    I did change the config to

    <ext assembly="uComponents.Core" type="uComponents.Core.XsltExtensions.Nodes" alias="ucomponents.nodes" />

    But still when using ucomponents.nodes i cant find the  GetReleaseDate and GetExpireDate.

     

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 17, 2011 @ 20:45
    Lee Kelleher
    0

    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.

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 17, 2011 @ 20:53
    Fuji Kusaka
    0

    Do i need to include this in my stylesheet as well

    xmlns:ucomponents.dates="urn:ucomponents.dates"
        exclude-result-prefixes="msxml umbraco.library ucomponents.dates

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 17, 2011 @ 21:14
    Fuji Kusaka
    0

    Cant get it working when using

    <xsl:value-of select="ucomponents.nodes:GetReleaseDate('Int32 nodeId')"/>
  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 17, 2011 @ 21:26
    Lee Kelleher
    1

    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:

    <xsl:value-of select="ucomponents.nodes:GetReleaseDate($currentPage/@id)"/>

    Cheers,  Lee.

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 18, 2011 @ 04:35
    Fuji Kusaka
    0

    Even this it wont let me save my xslt,

    <xsl:value-of select="ucomponents.nodes:GetExpireDate('$currentPage/@id')"/>



  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 18, 2011 @ 09:28
    Fuji Kusaka
    0

    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: )
  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 18, 2011 @ 10:04
    Fuji Kusaka
    0

    Finally got my XSLT to save by adding to my Stylesheet.

    xmlns:ucomponents.nodes="urn:ucomponents.nodes"  and
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour ucomponents.nodes"

    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

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 18, 2011 @ 19:44
    Fuji Kusaka
    0

    Any suggestion on this?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 18, 2011 @ 22:26
    Lee Kelleher
    0

    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.

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 19, 2011 @ 07:50
    Fuji Kusaka
    0

    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

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 19, 2011 @ 20:51
    Fuji Kusaka
    0

    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.

     

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Oct 19, 2011 @ 21:44
    Dan Diplo
    0

    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).

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 20, 2011 @ 08:55
    Fuji Kusaka
    0

    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

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 20, 2011 @ 21:00
    Fuji Kusaka
    0

    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??

     

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 20, 2011 @ 22:52
    Lee Kelleher
    0

    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.

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 21, 2011 @ 08:56
    Fuji Kusaka
    0

    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.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 24, 2011 @ 12:26
    Lee Kelleher
    0

    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.

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 24, 2011 @ 12:28
    Fuji Kusaka
    0

    Hi Lee,

    Yes am using it in a loop when i click on the related page i get the right "Date". 

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 24, 2011 @ 12:31
    Fuji Kusaka
    0

    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/> <href="{umbraco.library:NiceUrl(@id)}">View Details</a>    </div>        
          
          </xsl:for-each>
  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 24, 2011 @ 12:33
    Lee Kelleher
    1

    Thinking that you need to remove the $currentPage param? and only use the @id

    <xsl:value-of select="ucomponents.nodes:GetExpireDate(@id)" />

    Cheers, Lee

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 24, 2011 @ 12:41
    Fuji Kusaka
    0

    Got it working ...

    <xsl:value-of select="umbraco.library:FormatDateTime(ucomponents.nodes:GetExpireDate(@id), 'dd MMM  yyy')"/>

    thanks Lee

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 24, 2011 @ 12:50
    Lee Kelleher
    0

    Woo! Glad that we go there in the end!

Please Sign in or register to post replies

Write your reply to:

Draft