Copied to clipboard

Flag this post as spam?

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


  • Sony 20 posts 40 karma points
    Dec 24, 2010 @ 10:51
    Sony
    0

    Change template upon admin selection in umbraco backend

    hello all,

                 As i need to change the templates of a page which displays advertisements at top,bottom,left and right depending upon the admin selection at the backend. if admin choose top from the "pick template" dropdown property in the backend then the page should get displayed using the template with advertisements at the top.

        i have four templates for top, bottom, left and right advertisement column separetly. i need to choose the one of the template based on admin selection at the backend. how can i accomplish this task.. is it possible?

    thank & regrads,

    Sony

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Dec 24, 2010 @ 11:13
    Hendy Racher
    0

    Hi Sony,

    Do you want the admin user to be able to pick a template ? or for the template to be automatially picked depending on where the page is within the content tree ?

    If you want it manually pickable, then when defining the document type in the setting section, simply associate a number of 'Allowed templates', the admin can then select one of these in preference to the default template when editing.

    HTH,

    Hendy

  • Sony 20 posts 40 karma points
    Dec 24, 2010 @ 13:17
    Sony
    0

    No. what i exactly need is to choose different templates using (xslt or usercontrol) based on some conditions..

    thank you Hendy for your reply.. any pointers?

    thank you

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 25, 2010 @ 00:17
    Kim Andersen
    0

    Okay, so you want to use one of the four templates, depending on more than one condition choosen by the admin in the backend? Then you might want to take a look at the alttemplate-parameter. This is a parameter that you can use to change the template on a node. Let me give you an example:

    You have a node inside of Umbraco that uses a template called "temp1" and the node name of that node is "page1". To see the page you go to this url: www.domain.com/page1.aspx. This will show the node using the temp1-template. But let's say that you want to view the same node with another template called "temp2". Then you can go to the page like this: www.domain.com/page1.aspx?alttemplate=temp2 (or even www.domain.com/page1/temp2.aspx). This should give your the ability to change the template on the frontend by linking to the different alttemplates depending on the admin's choices.

    Does that make sense?

    If you only have one condition that the template depends on, I would for sure just go for the solution that Hendry came up with, and just give the admin the possibility of selecting the right emplate from the "Property"-tab. Would make things a lot easier. But if you have more than one condition, I think you want to use the alttemplate-parametre.

    I hope the above gives ou a small clue about how you can use different templates on the rendered site :)

    /Kim A

  • Torben Jensen 13 posts 35 karma points
    Dec 29, 2010 @ 23:01
    Torben Jensen
    0

    Well, you do not specify HOW different the templates should be.. ? I just allowed my editors to select between different styles for each page, however I could get along just selecting different CSS files.

    You could perhaps do something similar ? I set up a content type "css selector" with bullet list selections, then checked for the alias in XLST. You should also be able to access and use the alias in some inline ASP code.

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 03, 2011 @ 21:20
    Kim Andersen
    0

    Hi Sony

    Did you ever find out how you would solve this issue? Could be nice to know if you used some of our pointers, or if we where totally off.

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft