Copied to clipboard

Flag this post as spam?

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


  • pikkenix 17 posts 37 karma points
    May 05, 2011 @ 11:42
    pikkenix
    0

    Append text to title

    I'm trying to add some extra text to the title for some of my pages using a .NET UserControl.

    My template structure looks like this:

    MasterpageTemplate
      PageTemplate

    My MasterpageTemplate has this code for setting the page Title:

    <head runat="server>
    <title>
    <
    umbraco:Item runat="server" field="pageName" /> - <umbraco:Item runat="server" field="siteName" recursive="true" />
    </title>
    </head>

    I use this to change the title in my UserControl:

    Page.Title = "My Page Title";

    I think this actually works - BUT the <umbraco:Item /> overwrites my title. When i use the following code in my MasterPageTemplate the above code does work:

    <head runat="server>
    <title></title>
    </head>

     

    What I want is to add the <umbraco:Item /> to my existing Title (wish is added by my UserControl first), exampel "My Page Title, *pageName* - *siteName*".
    How do I do this?

  • Rich Green 2246 posts 4008 karma points
    May 05, 2011 @ 11:55
    Rich Green
    0

    You can read the umbraco values directly in your user control using the API or uQuery.

    Then you could just do (pseudo code)

    Page.Title = umbracoValue1 + umbracoValue2 + "My Page Title";

    Rich

  • pikkenix 17 posts 37 karma points
    May 05, 2011 @ 12:57
    pikkenix
    0

    Sounds like what I'm looking for. Do you have any example or documentation I can read about reading umbraco values?

  • Rich Green 2246 posts 4008 karma points
    May 05, 2011 @ 13:07
    Rich Green
    1

    Hi,

    Some documentation here http://our.umbraco.org/wiki/reference/api-cheatsheet/working-with-the-nodefactory

    Or the Umbraco TV API video is good too.

    You can also use uComponents uQuery http://ucomponents.codeplex.com/wikipage?title=uQuery

    Rich

     

  • pikkenix 17 posts 37 karma points
    May 05, 2011 @ 13:11
    pikkenix
    0

    Great, thank you very much Rich!

  • 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