Copied to clipboard

Flag this post as spam?

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


  • Halldór Hrafn Gíslason 30 posts 50 karma points
    Sep 06, 2010 @ 13:34
    Halldór Hrafn Gíslason
    0

    Linking to Umbraco page based on it's document type

    Hi,

    I'm wondering how I would go about to create a link to a page, without knowing it's name forehand. But I would rather just look for the next page of a certain document type.

    For example; I have a User profile page (and document type) which is baed upon user controls. Under that I have another (child) page called "edit profile" with it's own document type. How would I add a link to the "user profile" -page that would link to the "edit profile" -page, when I don't know it's published name.

    The reason I'm doing this is that I want to mirror the site in multiple languages, so there would be other versions of these same pages. So instead of redoing the link for every page, I'd like to do this in code (or xslt, whichever is more convinient).

    with thanks,
    H.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 06, 2010 @ 13:41
    Dirk De Grave
    1

    you don't need to know a document's name, you can get to that page based on the properties of a page. For example: 

    umbraco.presentation.nodeFactory.Node currentNode = umbraco.presentation.nodeFactory.GetCurrent();
    var children = currentNode.Children;
    foreach (umbraco.presentation.nodeFactory.Node childNode in children) {
      var alias = childNode.ContentType.Alias;
    }
    

     

    Hope this helps.

    Regards,

    /Dirk

     

Please Sign in or register to post replies

Write your reply to:

Draft