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?
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. :-)
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.
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.
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
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.
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?
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
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
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
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
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
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?
is working on a reply...