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.

Calendar, multiple weblogs, and "if entries"

May 03, 2011 11:17am

Subscribe [1]
  • #1 / May 03, 2011 11:17am

    LynneL

    239 posts

    No one else seems to have asked the question before that I can find…so I’ll ask it here.

    I’m adding a new calendar entry type to an existing 1.x installation, as they want to add “intranet” event items to their calendar (and I have to test for IP and all, but I have that all relatively figured out). So I duplicated the existing calendar fields in a new weblog and now have to do some complex conditionals.

    What I need to do is, in the “full” calendar tag, at the moment for the output of the events (inside the table cell of the “day” but before the output of the actual event item) I need to test for which weblog is outputting the entry, and if it’s the new type, do some extra doodads. This code does not work (in fact it produces a calendar all blank days where there should be events):

    {if entries}
        <td class='{switch}' align='center'>{day_number}
            {entries}
                {if weblog_id == 35 }
                    <div><a href="http://{path=calendar/event-detail}{url_title}">{title}</a>
    
                    <span class="calendarDate">{entry_date format="%g:%i %a"}</span></div>
                {if:elseif weblog_id == 41}
                    Some other stuff (an embed with PHP probably)
                {/if}
            {/entries}
        </td>
    {/if}

    I am guessing this means the weblog_id variable (I’ve also tested with weblog_short_name) is not available in the {entries} calendar tag. However, I need some way to do this that will integrate the items of the new calendar but allow me to conditionally run different code if it’s the new weblog. Any ideas?

  • #2 / May 04, 2011 12:45am

    Lisa Wess

    20502 posts

    Hi, LynneL -

    You can find the available variables on this page in the user guide.  At this point, you may need to use the query module to pull in the information you need.

    Another option is to investigate if Solspace’s Calendar Module might be a better fit if you need a more robust solution.

    Does that help?

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

ExpressionEngine News!

#eecms, #events, #releases