Copied to clipboard

Flag this post as spam?

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


  • Daniel Harris 33 posts 94 karma points
    May 25, 2011 @ 23:09
    Daniel Harris
    0

    Should I be using XSLT and Macros to do most of content layout?

    Hi,

     

    I just recently moved to using Umbraco, and have used XSLT to build my navigation.

    Now I have built some document types, create documents of that type with their content.

    To display the content, is it best practice w/ Umbraco to do this using XSLT and Macros, and having only the static parts of the pages in my Masterpages (Templates)

    Or am I using XSLT too much, if i'm using it to layout an entire documents content?

    Essentially what i've done so far is have a master page for the document type, then used XSLT and a Macro, and put the Macro into the Master Page.

     

    Any guidance would be much appreciated.

    P.S With Umbraco is all of the sites content stored in XML, or in the Database? Seems from any XSLT/Macro I can access any content through XSLT.

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 25, 2011 @ 23:21
    Lee Kelleher
    1

    Hi Daniel,

    There's no problem in using XSLT to render most of your content - leaving the static elements to the MasterPage templates.

    My main concern would be maintainability ... are you the sole developer? or work in a team?  Will other developers be able to locate areas of code to change/modify?

    Personally I use XSLT macros to do a simple task, then get out of there; functionality like navigation / lists is ideal for XSLT.  I once developed a website that had a massive XSLT (1000s LoC) - was absolutely horrible to debug/maintain!!  Hence why I break them down into smaller macros.

    If you're having thoughts about performance, then look at the caching options, very flexible.

     

    As for data access, all of the published content is stored in an XML cache for super fast access.  Ultimately all data is stored in the database, of which the XML cache is created from - and saved on disk in ~/App_Data/umbraco.config.

    I'm sure you'll have more questions! :-)

    Cheers, Lee.

  • Daniel Harris 33 posts 94 karma points
    May 25, 2011 @ 23:34
    Daniel Harris
    0

    Thanks for the info Lee!

     

    Usually I don't really develop in .NET using a CMS such as Umbraco. My experience is mainly with building custom web and desktop applications, so I will usually create an object model, and use something such as Microsoft Enterprise Library for Data Access.

    When doing this, being able to create classes, with properties suits me, but Umbraco should make sites much quicker for me to develop.

    I usually create User Controls (.ascx) to aid maintainability, and when I need to load content I retrieve it from the Database and instantiate the relevant objects.

    I am the only developer on this project, and until now haven't used XSLT. It's very handy for navigation and lists like you sais, and I founding writing the Navigation very quick.

    The real thing i'm unsure about comes to when I want to allow user feedback on a document, for example to allow a user to rate some content.

    Normally I would have an object say Garage.cs and one of the properties would be a List<Review>, so when a review was added it would be stored in the DB, then when the garage is loaded it's reviews can be accessed from the property.

    That is a poor example, but for the sake of an example it will do, just to show you how i'm used to developing.

    How would I add a rating to an Umbraco document? The part i'm not sure is it is data submitted by a user, rather than a content editor.

     

    Hope that makes sense.

     

    Thanks

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 25, 2011 @ 23:42
    Lee Kelleher
    1

    Hi Daniel,

    There's a little rule of thumb about which type of macro to use: "For input use .NET user controls, for output use XSLT".

    ... but that might be a little dated now that Razor is available.  Given your .NET background, I'd suggest that you do look Razor - saves you having to learn XSLT (unless you really want to?)

    Speaking of objects - have you looked at the uSiteBuilder project? You might find it very useful.

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft