Copied to clipboard

Flag this post as spam?

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


  • Pete 152 posts 176 karma points
    Oct 09, 2009 @ 13:24
    Pete
    0

    How do I create and reference a custom page for the right-hand pane in the CMS?

    For example... if was creating some custom stats to display in a custom Section in the CMS, how would I add that page into the project and make it available via a click in a custom tree? 

    e.g. Javascript.Append("\r\nfunction openContent(id) {\r\n\tparent.right.document.location.href = '*what goes here?*' + id;\r\n}\r\n");

    A link like that in the custom tree would link to something, but what? All the existing ones I can see seem to use built-in pages under the umbraco folder, which exists in the website, but not in the project. 

     

    I hope that makes sense.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 09, 2009 @ 13:35
    Aaron Powell
    0

    You need to assign the action of the node in the tree to open the page in JavaScript.

    I can't recall off the top of my head (there's a Tree wiki article, check that out), but it's something like 'window.parent.location.href=/myPage.aspx'

    you'll also have to make sure your custom page is in a folder which is excluded from Umbraco (or it is explicitly excluded), which is in the web.config (again, I don't recall off the top of my head what the properties are).

  • Pete 152 posts 176 karma points
    Oct 09, 2009 @ 13:38
    Pete
    0

    Cheers slace.

    The javascript part is fine - it's the creation of the page it opens that I'm unsure about. 

    Where do I put it? Can I just create an aspx page and put it in (which folder?) and it will work? Will that then be accessible from the front-end too?

  • Simon Justesen 436 posts 203 karma points
    Oct 09, 2009 @ 13:55
    Simon Justesen
    0

    You can put it whereever you like, as long as the path is correct. But since it is an internal page accessible from within umbraco, I suggest you put it inside/umbraco/, then you don't have to make adjustments to reservedurl in web.config

  • Simon Justesen 436 posts 203 karma points
    Oct 09, 2009 @ 13:57
    Simon Justesen
    0

    correction: " I suggest you put it in a folder inside/umbraco/..." :)

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 09, 2009 @ 15:24
    Aaron Powell
    0

    Actually Simon it's not advised to put it into the /umbraco/ folder. This folder should contain the core of Umbraco and be able to be deleted/ recreated with an Umbraco release. If you're putting custom pages/ sections into it then you run the risk of loosing that if/ when you upgrade.

    Umbraco supports putting pages anywhere and having them excluded from the Umbraco pipeline. You can use the umbracoReservedUrls to specify a path (eg: /pages/customPage.aspx) which may reside somewhere that may have Umbraco pages 'around' it. Alternatively you can exclude an entire folder (which is how /umbraco/ works) by using the umbracoReservedPaths property.

    Both of those settings are within the web.config -> appSettings section.

    If you're going to create custom pages for either backend or front end use it's strongly advise that you place them in a location excluded in that manner.

     

    Additionally you should make sure your custom page inherits from umbraco.BasePages.UmbracoEnsuredPage, businesslogic.dll as that class will ensure that here is someone logged into the Umbraco backend before the page is served to them.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 09, 2009 @ 15:26
    Aaron Powell
    0

    (PS - apologies if my first post wasn't clear, I'd only just got in from the pub :P. But I do my best Umbraco work after a beer or two :P)

  • Pete 152 posts 176 karma points
    Oct 09, 2009 @ 15:41
    Pete
    0

    haha... awesome, cheers guys! 

    I think that's clarified everything nicely. I figured I shouldn't be putting them in /umbraco/ as there's no way to push to that from the project itself.

     

    Cheers!

  • Simon Justesen 436 posts 203 karma points
    Oct 10, 2009 @ 01:14
    Simon Justesen
    0

    slace:

    Actually Simon it's not advised to put it into the /umbraco/ folder. This folder should contain the core of Umbraco and be able to be deleted/ recreated with an Umbraco release. If you're putting custom pages/ sections into it then you run the risk of loosing that if/ when you upgrade.

    A very valid point, but as long as you move your custom folders away from the umbraco folder during upgrade, you should be safe. I like to hide away essential backend files from the admin user. Often the umbraco folder is the only folder that is safe from their experiments :)

    (PS - apologies if my first post wasn't clear, I'd only just got in from the pub :P. But I do my best Umbraco work after a beer or two :P)

    That's how real artists work ;)

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 10, 2009 @ 01:32
    Aaron Powell
    0

    True enough points. I often find it easiest when upgrading Umbraco to just delete the Umbraco folder (I'd recommend this in for 4.0 -> 4.1) as that way you don't end up with files which have been 'discontinued' in Umbraco still lingering around. Umbraco 4.1 will have a drastically smaller /umbraco/ footprint and i can't for the life of me remember which files/ folders were removed. Easier to start a fresh ;)

    But that's a case of how you can run into problems if the person doing the upgrade isn't aware of the custom stuff you've added

Please Sign in or register to post replies

Write your reply to:

Draft