Copied to clipboard

Flag this post as spam?

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


  • Sean Dooley 289 posts 528 karma points
    Oct 03, 2011 @ 17:32
    Sean Dooley
    0

    single doc type different templates dependent on parent

    Currently have a site setup as follows

    Content
    > Root
    >> Home
    >> Store Front A
    >>> Category A
    >>>> Product A1
    >>>> Product A2
    >> Store Front B
    >>> Category B
    >>>> Product B1
    >>>> Product B2

    The Store Front doc types have different styling/template, and both can have a Category and Product doc types as children. There isn't a separate Category and Product doc type for each Store Front.

    The pages below the respective Store Fronts need to use the styling/template of its parent Store Front.

    Is a good way to do this to use altTemplate? Any other ideas would be welcome?

  • Nigel Wilson 945 posts 2077 karma points
    Oct 03, 2011 @ 20:47
    Nigel Wilson
    0

    Hi Sean

    I don't have the code for you but you could look to insert some functionality in your templates to determine what store front the current node us under and output a css file link accordingly.

    If I get a chance to figure out some code I'll add another post, that is if someone else doesn't provide it before I get there. :-)

    HTH

    Nigel

     

  • Nigel Wilson 945 posts 2077 karma points
    Oct 03, 2011 @ 21:00
    Nigel Wilson
    0

    Hey

    This isn't the answer but it might help you to achieve what you are after. 

    The following is a razor script that incorporates uQuery / uComponents. If you know the level your store fronts are at then you could modify this script to output the relevant <link> to your css file.

    http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/dynamic-title-(using-uquery)

    The above could also be done in XSLT I am sure.

    Cheers

    Nigel

  • Rich Green 2246 posts 4008 karma points
    Oct 03, 2011 @ 21:12
    Rich Green
    0

    Hi Sean,

    I would have 2 Master templates for your Store Fronts, then add your Category & product templates as 'children' of the Store Front Master templates

    Set the appropriate template for each Store Front and you should be all set as styling can be achieved in the master template, if this isn't flexible enough then each Category & product template can have different layouts too.

    Rich 

  • Sean Dooley 289 posts 528 karma points
    Oct 04, 2011 @ 11:07
    Sean Dooley
    0

    Thanks for the responses Nigel and Rich. Think I was looking for a way of dynamically setting which Master Page was to be used for any page residing under a Sho p Front so that it would pick up the relevant stylesheet and parent template. Below is the current structure, which is likely to change to be similar to what Rich has suggested whereby I would have to move the Product and Category templates to inherit from Shop Front rather then Page.

    I was trying to avoid this and be too clever but can't think of another way to do this.

    Doc Types

    Meta Options
    > Base Options
    >> Main Master
    >> Home Page
    >> Shop Front
    >> Product
    >> Page
    >>> Category

    Templates

    MainMaster
    > Home Page
    > Shop Front
    > Page
    >> Product
    >> Category

  • Rich Green 2246 posts 4008 karma points
    Oct 04, 2011 @ 11:38
    Rich Green
    0

    Hey Sean,

    You could switc Master templates using logic. It's what Microsoft do on their TechNet site as described in this video http://codegarden11.com/sessions/day-2/slot-one/multi-environment-team-based-development-with-umbraco-at-microsoft.aspx There's a code snippet at the end, it's 6 lines of code, I don't have it here sorry.

    However there surely has to be some flag in the CMS to say which 'style' to use, so keeping it simple Master Templates, and switching the templates will do the job.

    Cheers

    Rich

  • Sean Dooley 289 posts 528 karma points
    Oct 04, 2011 @ 15:48
    Sean Dooley
    0

    Looking at the possibility of using altTemplate to achieve required outcome.

    Any ideas about adding a rule to UrlRewriting.config so that for any page/link under a shop front would have the relevant altTemplate set?

Please Sign in or register to post replies

Write your reply to:

Draft