Copied to clipboard

Flag this post as spam?

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


  • Rik Helsen 670 posts 873 karma points
    Dec 08, 2009 @ 10:23
    Rik Helsen
    0

    how do i output the creatorName in a page template?

    I'm having issues outputting the name of the author that created a blogpost, for some reason it doesn't output anything?

    In xslt it's displayed elsewhere like this:

    <xsl:value-of select="$post/@creatorName"/>

    but in the page template i don't have this variable available?

    This piece of code always returns a blank output:

    <umbraco:Item field="creatorName" runat="server"></umbraco:Item>

     

    This is the information that's in the database for the node that i'm testing with (created with livewriter)



    <node id="1630"
    version="114535b8-a638-4bd0-8a00-cc72528910a9"
    parentID="1622"
    level="7"
    writerID="0"
    creatorID="6"
    nodeType="1219"
    template="1216"
    sortOrder="2"
    createDate="2009-11-27T12:49:16"
    updateDate="2009-11-27T13:49:14"
    nodeName="Update - Lijst milieubijdragen 01/02/2009"
    urlName="update---lijst-milieubijdragen-01022009"
    writerName="Administrator"
    creatorName="Chris"
    nodeTypeAlias="BlogPost"
    path="-1,1116,1044,1224,1605,1606,1622,1630"><data alias="bodyText"><![CDATA[
    <p>De laatste update in PDF versie.</p>

    <p>Download hier de laatste update van de milieubijdragen. De
    wijzigingen werden gemarkeerd.</p>

    <div class="wlWriterEditableSmartContent"
    id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:9d7c6dfe-6849-4aa3-a67f-13e3a8911e01"
    style="margin: 0px; display: inline; float: none; padding: 0px;">
    <div><a
    href="/media/14363/WindowsLiveWriter_UpdateLijstmilieubijdragen01022009_B44B_Lijst_Milieubijdragen_-_update_01_02_2009.pdf"
    target="_self">Lijst_Milieubijdragen_-_update_01_02_2009.pdf</a></div>

    <br />
    <br />
    </div>
    ]]></data><data alias="tags"><![CDATA[Milieubijdrage]]></data></node>

     

    All help is appreciated!

     

     

     

  • Patrik Wibron 40 posts 67 karma points
    Dec 08, 2009 @ 10:33
    Patrik Wibron
    0

    http://en.wikibooks.org/wiki/Umbraco/Reference/Umbraco_XML_Format

    Use the @writerName to output the publisher of the document.

    /Patrik

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 08, 2009 @ 10:44
    Dirk De Grave
    0

    Rik,

    use

    <%= umbraco.presentation.nodeFactory.node.GetCurrent().CreatorName %>

    to get the creator's name from the node

     

    Cheers,

    /Dirk

  • Rik Helsen 670 posts 873 karma points
    Dec 08, 2009 @ 10:47
    Rik Helsen
    0

    Thanks dirk but i seem to be missing something in order to be able to use the presenation.nodeFactory:

     

    Server Error in '/' Application.

    Compilation Error


    Description: An
    error occurred during the compilation of a resource required to service
    this request. Please review the following specific error details and
    modify your source code appropriately.

    Compiler Error Message: CS0234:
    The type or namespace name 'node' does not exist in the namespace
    'umbraco.presentation.nodeFactory' (are you missing an assembly
    reference?)

    Source Error:

    Line 11: <%= umbraco.library.GetDictionaryItem("by") %>
    Line 12: <umbraco:Item field="writerName" runat="server"></umbraco:Item>
    Line 13: <%= umbraco.presentation.nodeFactory.node.GetCurrent().CreatorName %>
    Line 14:
    Line 15: </span>
  • Rik Helsen 670 posts 873 karma points
    Dec 08, 2009 @ 10:53
    Rik Helsen
    0

    Patrick: i need the creatorname, not the writername ;)

  • Rik Helsen 670 posts 873 karma points
    Dec 08, 2009 @ 10:56
    Rik Helsen
    1

    Dirk: Thanks i got it, the there was an error with capitalisation of the "nodes" part in your case , this fixed it:

     

     

    <%= umbraco.presentation.nodeFactory.Node.GetCurrent().CreatorName %>

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 08, 2009 @ 11:06
    Dirk De Grave
    0

    Yup, my bad! Glad you sorted that out! 

     

    Cheers,

    /Dirk

  • Andraž 45 posts 65 karma points
    Dec 21, 2009 @ 10:32
    Andraž
    0

    Hello,

    i'am sorry for posting this under solved problems...

    Why doesn't it work for @nodeName?

    <%= umbraco.presentation.nodeFactory.Node.GetCurrent().nodeName %>

    I get: CS0117: 'umbraco.presentation.nodeFactory.Node' does not contain a definition for 'nodeName'

     

    Thx,

    Andraž

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 21, 2009 @ 10:45
    Dirk De Grave
    0

    Because nodeName is not defined as property on a node object, use .Text to get the name of the node as it appears in the conten tree.

     

    Cheers,

    /Dirk

  • Andraž 45 posts 65 karma points
    Dec 21, 2009 @ 11:21
    Andraž
    0

    I did that, so i have now:

    <%= umbraco.presentation.nodeFactory.Node.GetCurrent().Text %>

    but i'am still getting the same error.

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 21, 2009 @ 11:36
    Dirk De Grave
    0

    Oops, use .Name instead...

     

    Cheers,

    /Dirk

  • Andraž 45 posts 65 karma points
    Dec 21, 2009 @ 12:16
    Andraž
    0

    Great, thanks :)

    Andraž

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

Please Sign in or register to post replies