ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Creating templates for sites with multiple blogs

July 31, 2007 9:41am

Subscribe [5]
  • #1 / Jul 31, 2007 9:41am

    JT Thompson

    745 posts

    In creating my new site I decided to use multiple blogs instead of categories.

    The question i have is in regards to the comment pages.

    The way I have my sites, there are different templates used to build a single page. header, body, etc. Currently I need only one ‘body_comments’ because I only use one blog. But i’m trying to figure out if there’s a way to create a single template that can dynamically use different blogs. I’ll see if I can explain.

    At the top of the page, or whever you have the ‘weblog:entries’ tag placed, you specify the blog that the data is coming from. But unless I’m mistaken this means if I use 4 different blogs for one site, I’ll need 4 identical templates for the comments pages because I have to specify the blog using hard coding in the template.

    Is there a way that this can be changed so I need only create one template? I’d rather not have to create 4 templates to do the same thing, but I can’t figure out how to dynamically specify which blog to use.

  • #2 / Jul 31, 2007 10:07am

    tulkul

    45 posts

    what worked for me was to put the following in the head of the comments template

    {assign_variable:my_weblog=""}
    {assign_variable:my_template_group="main"}

    where “main” is the default_site template group and the “” automatically pulls from all the weblogs ...

    I use this with my home page to update it with the latest entries from all of the other weblogs

    maybe this will work for you?

  • #3 / Jul 31, 2007 10:40am

    Boyink!

    5011 posts

    Embeds with embedded variables are what you want.

    In each of of your 4 single entry templates:

    {embed="templategroup/weblog_entry_comments" the_weblog="{my_weblog}"}

     

    Then the weblog_entry_comments code is:

    <h3>Comments</h3>
    <p>{exp:comment:entries weblog="{embed:the_weblog}"}<br />
    etc…

    I went a step further and did the same approach for my weblog index pages and single-entry views - so all 4 weblogs run from common embedded templates.

  • #4 / Jul 31, 2007 10:48am

    JT Thompson

    745 posts

    Fantastic. Great info. Thanks guys!

  • #5 / Aug 05, 2007 12:36pm

    trixpan

    9 posts

    I went a step further and did the same approach for my weblog index pages and single-entry views - so all 4 weblogs run from common embedded templates.

    Hi Boyink,

    I guess you did what I’m looking after.

    I’m currently setting up a multi-author site.

    Every author will have it’s own blog, but all with the same look. I was wondering if can can run the whole site from only one or two templates.

    Something like one template for the site homepage, without comments, trackbacks, etc. And another template for the individual blogs.

    Is it possible to do?

    I thank you in advance

  • #6 / Aug 05, 2007 2:30pm

    Boyink!

    5011 posts

    In my case I run common embedded templates, but each author/blog has it’s own template group with “parent” templates where weblog names and template groups are specified (for link building), blog-specific CSS is stored, and page titles are set.

    You’re also going to want to make sure your use of EE falls within the licensing agreement—around the area of not building a hosted blogging service.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases