Copied to clipboard

Flag this post as spam?

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


  • gilad 185 posts 425 karma points
    Apr 11, 2011 @ 11:09
    gilad
    0

    templating issue

    hello everyone.

    i have some issue that i not solved.

    lets say i have a  3  deffrent  document types.

    each one has diffrent template.

    all of them has a list of sub pages of same ducoment type  - lets say content page.

    now.. when the user create content page in one of the document type =>

    I do not want the user can choose template..

    becuse if the user want to create content page under ducoment type 1 => it should be template 1.

    if under ducomenttype 2 => it should be template 2.

    and I do not want the user choose template 2 under ducoment type 1.

    Do I have to duplicate this content page?


    hope my question clear.

    thanks.

     

  • Eran Meir 401 posts 543 karma points
    Apr 11, 2011 @ 11:16
  • Daniel Bardi 927 posts 2562 karma points
    Apr 11, 2011 @ 12:17
    Daniel Bardi
    0

    Assign a single template to each doctype

    If each template has similar content, create a master template and place both as children, then assign a single template to the respective doctype.

  • Daniel Bardi 927 posts 2562 karma points
    Apr 11, 2011 @ 12:23
    Daniel Bardi
    0

    Create a master content page doctype and create 3 separate subcontent page doctypes as child doctypes; each with their own template.  Then, using structure, only allow 1 of each of the doctypes under it's respective parent doctype.

    The child doctypes do not need to contain any properties, they will inherit from the master content doctype

  • gilad 185 posts 425 karma points
    Apr 11, 2011 @ 12:26
    gilad
    0

    hii eran.

    thanks for the quick answer. (toda raba)

    well... Maybe it can help..

    But I thought there was a simple way to associate a page to parent template...

    i guess i shoud duplicate this document type..

    it could be a graet idea that pages can automatically gets parent template...

    like.. lets say i have 3 template with same ContentPlaceHolder ID.

    and now i want to create one template with ContentPlaceHolderId that automatically sit under the parent - ducoment type template.

    thanks again. bey.

  • gilad 185 posts 425 karma points
    Apr 11, 2011 @ 12:34
    gilad
    0

    hii daniel...

    that a good idea..

    somthing like this:

    ductype => has some propityes..

     --- duc 1 => for template 1

    --- duc 2 => for template 2

    i guess im gonna use this!

    thank you!

  • Eran 292 posts 436 karma points
    Apr 11, 2011 @ 12:45
    Eran
    0

    Hi Gilad, i'm writing here because you didnt publish any contact detail.
    in this days we are creating the first israeli umbraco user group, in tel aviv.
    if you want more info please follow my twitter or send me your email.

    Thanks.

  • Daniel Bardi 927 posts 2562 karma points
    Apr 11, 2011 @ 12:46
    Daniel Bardi
    0

    That's exactly the way to do it.

    You could also write a macro to render a page using a specific template based on the parent document type  (umbraco.library:RenderTemplate)

  • gilad 185 posts 425 karma points
    Apr 11, 2011 @ 13:03
    gilad
    0

    daniel - 

    It looks more elegant way to do that..

    any posts , documentation or video about that?

     


  • gilad 185 posts 425 karma points
    Apr 11, 2011 @ 13:03
    gilad
    0

    hii eran.

    really happy to hear about the first israeli umbraco user group.

    I sent you a E-mail.

  • Daniel Bardi 927 posts 2562 karma points
    Apr 11, 2011 @ 13:15
    Daniel Bardi
    0

    1. You'd create the ContenPage templates the under a master template.

    2. Assign the master template as the only template for the ContenPage doctype

    3. The macro would check the currentPage parent name() value (xsl:if or xsl:choose)

    4. Based on parent node name(), execute the following xslt: (where $templateId is the child ContentPage template id)

    <xslt:value-of select="umbraco.library:RenderTemplate($currentPage/@id, $templateId)"/>

    5. Place the macro in the master template.

    Note: you can get the template id by viewing the template editor querystring (i.e. open frame in new tab and note url)

  • Daniel Bardi 927 posts 2562 karma points
    Apr 11, 2011 @ 13:18
    Daniel Bardi
    0

    Note... you will have to override the macro execution in the child templates by wrapping the macro in a contentplaceholder in the parent template and inserting blank content for it in the child template.

    Here's the layout I envision :

    Templates:

    Master ContentPage Template (contains only macro in "macro" contentplaceholder)

    -- ContentPage1 Template (empty content referencing "macro" placeholder)

    -- ContentPage2 Template (empty content referencing "macro" placeholder)

    DocumentTypes:

    Doctype1 (allows ContentPage)

    Doctype2 (allows ContentPage)

    ContentPage (Using Master ContentPage Template)

    Macro

    Checks for ContentPage parent (either Doctype1 or Doctype2)

    Renders ContentPage1 or ContentPage2

  • gilad 185 posts 425 karma points
    Apr 11, 2011 @ 14:02
    gilad
    0

    Thank you for your investment daniel.

    I will try this later.

    Meanwhile i use your first solution.

    thanks again.

    you helped me a lot.



  • Daniel Bardi 927 posts 2562 karma points
    Apr 11, 2011 @ 14:05
    Daniel Bardi
    0

    No problem.. it's an investment in the community.

    Let know the results... don't forget to mark a post as the solution.

Please Sign in or register to post replies

Write your reply to:

Draft