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.

Weblog Feeds - One Feed with Conditionals.

January 13, 2009 12:45am

Subscribe [1]
  • #1 / Jan 13, 2009 12:45am

    EvanSnyder

    9 posts

    Like many, I figured what I wanted to do would be fairly straight forward. I have 3 weblogs that I want to combine into one RSS feed. I can get two to work with out a hitch, but adding that third is where things get weird.

    This makes the page fail to render (one elseif and one else condition):

    {exp:weblog:entries weblog="{master_weblog_name}" limit="10" rdf="off" dynamic_start="on" disable="member_data|trackbacks"}
        <item>
          <title>
          {exp:xml_encode}
          {title}
          <![CDATA[
              {if weblog_id==1}{title}
              {if:elseif weblog_id==2}{title}
              {if:else weblog_id==3}{link-text}
              {/if}]]>
          {/exp:xml_encode}
          </title>
          <link>
          <![CDATA[
              {if weblog_id==1}{title_permalink=thinking/index}
              {if:elseif weblog_id==2}{link}
              {if:else weblog_id==3}{link}
              {/if}]]>
          </link>
          <guid>
          <![CDATA[
              {if weblog_id==1}{title_permalink=thinking/index}
              {if:elseif weblog_id==2}{link}
              {if:else weblog_id==3}{link}
              {/if}]]>
          </guid>
          <content:encoded>
          <![CDATA[
              {if weblog_id==1}{summary}<br><br><br>
              {if:elseif weblog_id==2}{quote}<br><br><br><a href="http://{link}">{spoken-by}</a><br><br><br>
              {if:else weblog_id==3}{description}<br><br><a href="http://{link}">permalink…</a><br><br><br>
              {/if}]]>
          </content:encoded>
          <dc:subject>{exp:xml_encode}{categories backspace="1"}{category_name}, {/categories}{/exp:xml_encode}</dc:subject>
          <dc:date>{gmt_entry_date format="%m.%d.%y"}</dc:date>
        </item>
    {/exp:weblog:entries}

    This renders just fine, but the third weblog (even with the newest item) is tacked on the very bottom/end of the page (two if:elseif condition):

    {exp:weblog:entries weblog="{master_weblog_name}" limit="10" rdf="off" dynamic_start="on" disable="member_data|trackbacks"}
        <item>
          <title>
          {exp:xml_encode}
          {title}
          <![CDATA[
              {if weblog_id==1}{title}
              {if:elseif weblog_id==2}{title}
              {if:elseif weblog_id==3}{link-text}
              {/if}]]>
          {/exp:xml_encode}
          </title>
          <link>
          <![CDATA[
              {if weblog_id==1}{title_permalink=thinking/index}
              {if:elseif weblog_id==2}{link}
              {if:elseif weblog_id==3}{link}
              {/if}]]>
          </link>
          <guid>
          <![CDATA[
              {if weblog_id==1}{title_permalink=thinking/index}
              {if:elseif weblog_id==2}{link}
              {if:elseif weblog_id==3}{link}
              {/if}]]>
          </guid>
          <content:encoded>
          <![CDATA[
              {if weblog_id==1}{summary}<br><br><br>
              {if:elseif weblog_id==2}{quote}<br><br><br><a href="http://{link}">{spoken-by}</a><br><br><br>
              {if:elseif weblog_id==3}{description}<br><br><a href="http://{link}">permalink…</a><br><br><br>
              {/if}]]>
          </content:encoded>
          <dc:subject>{exp:xml_encode}{categories backspace="1"}{category_name}, {/categories}{/exp:xml_encode}</dc:subject>
          <dc:date>{gmt_entry_date format="%m.%d.%y"}</dc:date>
        </item>
    {/exp:weblog:entries}

    Ideas?

    Thanks so much…

  • #2 / Jan 13, 2009 1:07am

    EvanSnyder

    9 posts

    Hmmm, I may have answered my own problem. I switched it to three separate if statements rather than trying to combine them as {if} {if:elseif} and {if:else}...

    Then I noticed a discrepancy in my dates which may be the issue behind the ordering of each post relitive to the others… I’ll report back when I figure that out.

    Long day I guess… sheesh.

  • #3 / Jan 13, 2009 1:12am

    EvanSnyder

    9 posts

    Yep, that was it, my date was being generate off which was causing them to offset incorrectly. Though I’m still a little miffed that the if statements weren’t working how I think they are supposed to… So like I said above, I’m using three seperate if conditions:

    {exp:weblog:entries weblog="{master_weblog_name}" limit="10" rdf="off" dynamic_start="on" disable="member_data|trackbacks"}
        <item>
          <title>
          {exp:xml_encode}
          {title}
          <![CDATA[
              {if weblog_id==1}{title}{/if}
              {if weblog_id==2}{title}{/if}
              {if weblog_id==3}{link-text}{/if}
              ]]>
          {/exp:xml_encode}
          </title>
          <link>
          <![CDATA[
              {if weblog_id==1}{title_permalink=thinking/index}{/if}
              {if weblog_id==2}{link}{/if}
              {if weblog_id==3}{link}{/if}
              ]]>
          </link>
          <guid>
          <![CDATA[
              {if weblog_id==1}{title_permalink=thinking/index}{/if}
              {if weblog_id==2}{link}{/if}
              {if weblog_id==3}{link}{/if}
              ]]>
          </guid>
          <content:encoded>
          <![CDATA[
              {if weblog_id==1}{summary}<br><br><br>{/if}
              {if weblog_id==2}{quote}<br><br><br><a href="http://{link}">{spoken-by}</a><br><br><br>{/if}
              {if weblog_id==3}{description}<br><br><a href="http://{link}">permalink…</a><br><br><br>{/if}
              ]]>
          </content:encoded>
          <dc:subject>{exp:xml_encode}{categories backspace="1"}{category_name}, {/categories}{/exp:xml_encode}</dc:subject>
          <dc:date>{date format="%Y %m %d"}</dc:date>
        </item>
    {/exp:weblog:entries}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases