Copied to clipboard

Flag this post as spam?

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


  • Leon Friesema 2 posts 22 karma points
    Aug 13, 2010 @ 10:15
    Leon Friesema
    0

    Use masterpage as page-alias does work, but from level 3+

    Hi there,

    I'm trying to get some masterpages working with simple content, controls or xslt's but without a contentpage. So for instance;

    I've created a sitemap master page, using the standard xslt, using my regular masterpage as parent.

    But clicking the link (using /sitemap) from any page will result in the first page (default).

    If I change the link using just sitemap (so without the /) the sitemap will only show from the third level up and using the breadcrumb (and location) from the parent of that page.

    So, what am I doing wrong here? (most likely something stupid I assume)

    TIA,

    Leon

    P.S. I am using v451

  • Sascha Wolter 615 posts 1101 karma points
    Aug 13, 2010 @ 12:07
    Sascha Wolter
    0

    Hi Leon,

    I am not really sure I understand your setup yet. To create a simple sitemap with nested masterpages you can do the following:

    1. create a new xslt 'sitemap' with the sitemap template selected, let Umbraco automatically create a macro for it, no need to modify the xslt

    2. create 3 document types, each with a template automatically created: home, sitemap and testdoc (the latter is just so we have content to see on the sitempa). Let home be able to have sitemap and testdoc as children and testdoc itself as child.

    3. create a new master template called master, inside the default content placeholder create a new one like so and maybe add the title of the current page to it:

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
     
    <h1><umbraco:Item field="pageName" runat="server"></umbraco:Item></h1>
      <asp:ContentPlaceHolder Id="MyContent" runat="server">
        <!-- Insert default "MyContent" markup here -->
      </asp:ContentPlaceHolder>

    </asp:Content>

    4. Let each of the templates home, sitemap and testdoc have 'master' as master template. After saving each template delete the content (everything apart from the first line) and add a new Content placeholder, e.g. the sitemap will look like this:

    <%@ Master Language="C#" MasterPageFile="~/masterpages/master.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderId="MyContent" runat="server">
      <umbraco:Macro Alias="Sitemap" runat="server"></umbraco:Macro>
    </asp:Content>

    5. Now it's time to create some nodes, your content should look something like this after you are done by using the respective doc types:

    Content
    - home
      - sitemap
      - testdoc1
        - testdoc 2
      - testdoc 3
      - testdoc 4

    6. When you click on the url on the 'properties' tab of the sitemap node you should get a nice sitemap with the name 'sitemap' on top.

    If you haven't done so the Umbraco.tv clips are definitely worth to watch and will introduce you to the Umbraco concepts in no time.

    Hope that helps,
    Sascha

  • Leon Friesema 2 posts 22 karma points
    Aug 13, 2010 @ 12:33
    Leon Friesema
    0

    Sascha,

    thanks for answering, but the sitemap is just an example actually.

    What I really want is to have templates served as content. The sitemap, in my example, will show but only in the 3rd (or beyond) level. I could've used my "CreateUser" page as example. This page should not exist as content within the content-tree, but should be a template (and shown at /createuser or something like that).

    Perhaps the title should be: "Can't seem to get a template served as contentpage" but since I can get the sitemap to show at some point...So the real question is: how do I get templates shown as content?

    Leon

  • Sascha Wolter 615 posts 1101 karma points
    Aug 13, 2010 @ 13:02
    Sascha Wolter
    0

    Hi Leon,

    I can't think of any way how this would be possible without creating a node in the content first (and thereby defining a url for the content to reside in the first place). One method would be to read out the content of the content template from the physical file and render it, yet I wouldn't even start thinking about this, it's really icky. There is a 'renderTemplate' function in umbraco.library, yet it requires a node id for each overloaded version.

    Which leads us to the question: why would you want to do this? I have a couple of web sites which contain content nodes that are just there so their content can be rendered on other nodes, e.g. via jQuery ajax calls. It's really simple to set this up, and for better organisation I usally create at least 2 top level nodes for each web sites, one is the web site's homepage and the other one is a 'data' node that contains basically everything which is not a browsable page (well, the distinction is quite blurry in practice).

    Sascha

Please Sign in or register to post replies

Write your reply to:

Draft