Copied to clipboard

Flag this post as spam?

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


  • Mark Bennett 199 posts 375 karma points
    Apr 22, 2012 @ 13:34
    Mark Bennett
    0

    Multiple blogs with multiple templates

    So I have several sites running in the same umbraco instance. I want to be able to have a blog for each different site with it's own specific look and feel - I'd also like the content provider to only be able to add into his Posts folder a content item with his specific template already applied. 

    I've tried lots of different ways to do this (copygin document types, copying templates) and none of them seem to work - when I create another set of temlates that replicate uBlogsy templates and I assign them to the content posts I start getting Razor errors.

    Can this be done??

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 23, 2012 @ 01:09
    Anthony Dang
    0

    If you want a specific template to be used when a specific user creates the post then you'll have to do it in an event hook.

    I would do it on the before save event

    http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events

     

    Also depends on what you mean by "different look/feel". How different? Completely different markup? Or can you do it via css? If so then you could render an extra class on the container of the base page, then do some css targeting.

     

     

     

     

  • Mark Bennett 199 posts 375 karma points
    Apr 23, 2012 @ 10:55
    Mark Bennett
    0

    Hi Anthony,

    Thanks for coming back to me and i'm liking the package by the way ;-) Little bit of a learning curve but I think i'm getting there.

    I'll have a look into the event hook but I have a feeling that won't solve my problem.

    By different look and feel I mean totally different style / layout / flow the first 2 sites I intended on setting it up for are http://www.corefituk.com/ and http://www.grifnett.com/Wyndley/

    From looking through uBlogsy most of the weekend then I don't think it can be done at the moment without me hacking about a bit. What I tried to do was create another blogLanding and blogPost doc type (copied from the uBlogsy ones) and then assign templates to them. However I started getting issues with the scripts not finding the blogLanding page and therefore getting lots of Razor errors. 

    Looking into the code it seems you look for specific hard coded document types and therefore that nailed the above idea. 

    Is there any chance I can get the source for version 2.1.0.0?

    Mark.

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 24, 2012 @ 11:03
    Anthony Dang
    0

    Sounds pretty straight forward.

    You want to use template A when user A creates posts and use template B when user B creates posts.

    In an event hook...

    When a content node is created, check the current logged in user. Set the sender.Template to the template you want to apply to that user.

     

    You only need to do the following:

    - Create your different templates

    - Add them as allowed templates to the relevant ublogsy doc types.

     

     

  • Mark Bennett 199 posts 375 karma points
    Apr 24, 2012 @ 12:07
    Mark Bennett
    0

    Hi Anthony,

    Thanks for the response and i'll be having a look at the event hooks this week.

    I'm sure I tried what you have said and I couldn't get it to work, but i'll have another crack and see how I get on. I've tried that many different ways now I can't remember quite what i've done.  

    But i'm going to create a nice new clean dev environment this week and start again so i'll take what you have said onboard and see where I get to.

    Cheers,
    Mark. 

Please Sign in or register to post replies

Write your reply to:

Draft