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.

display posts from multiple weblogs, in a given category

June 21, 2007 6:03pm

Subscribe [1]
  • #1 / Jun 21, 2007 6:03pm

    Michael Rog

    179 posts

    I’m using the Pages module (er… I guess it’s called “Tome” now) to run a static content site. (Yes, I’ll upgrade to 1.6 soon. Meanwhile…)

    There are press releases and announcements that relate to the various pages. So I set up a weblog for press releases and one for announcements, and assigned the same category group to each of them that the pages module uses. My plan is to put an expression in the default pages template that pulls any posts from the news or announcements weblogs that are in the same category as the current page. (That way, since I can control which press releases and announcements show up on each page.)

    So, before I delved into dynamically linking everything up, I just tried hardcoding it into the template, like this:

    {exp:weblog:entries weblog="news|announcements" category="homepage"}
    <h3>{title}</h3>
    <p>{summary}<br />
    <hr ><br />
    {body}<br />
    <hr ><br />
    {extended}<br />
    {/exp:weblog:entries}

    That didn’t work. So then I tried referencing everything by ID:

    {exp:weblog:entries weblog="5|6" category="65"}
    ...
    {/exp:weblog:entries}

    That didn’t work either. I’m going to go try to find what I’m missing in the docs… meanwhile, if anyone can quickly identify what I’m doing wrong and save me some time, that’d be really peachy.

  • #2 / Jun 21, 2007 6:06pm

    Michael Rog

    179 posts

    psh… stupid me….

    needed to reference the weblogs my shortname and the category by ID:

    {exp:weblog:entries weblog="announcements|news" category="65"}
    ...
    {/exp:weblog:entries}
  • #3 / Jun 21, 2007 6:35pm

    Michael Rog

    179 posts

    Now that I’ve got them displayed, I have to figure out how to generate the “read more” link…

    Essentially, the path is something like:
    index.php/weblog/test-announcement-one/
    where “weblog” is either “news” or “announcements” depending on the item.

    So my code is:

    {exp:weblog:entries weblog="announcements|news" category="65"}
    ...
    {url_title_path="{weblog}"}
    ...
    {/exp:weblog:entries}

    And what I get generated is…
    {url_title_path="Announcements"}

    Apparently, embedding that {weblog} variable in the {url_title_path=} variable messes things up. (I tried it with and without quotes.)

    How can I fix this?

    (I’ll try some conditionals in the meantime…)

  • #4 / Jun 21, 2007 6:56pm

    Michael Rog

    179 posts

    I added some conditionals:

    {exp:weblog:entries weblog="announcements|news" category="65"}
    ...
    {if weblog_id==5}
    {url_title_path=news}
    {if:elseif weblog_id==6}
    {url_title_path=announcements}
    {/if}
    ...
    {/exp:weblog:entries}

    And it works, but it is incredibly inelegant and won’t scale well… so I’m still looking for a way to dynamically generate the read more URL based on what weblog a post is from…

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

ExpressionEngine News!

#eecms, #events, #releases