0

I am trying to list upcoming events in Expression Engine. I have the following code:

{exp:calendar:events sort="asc" dynamic="no" status="current" event_limit="2"}
  <p><a href="{url}">{title}</a></p>
{/exp:calendar:events}

I am unable to retrieve the full path (www.domain.con/etc/etc). I have tried url_title in the href but it is just the name of the entry.

These entries belong to a channel called Calendar: Events if that matters.

What is the tag to get the full path to an Entry?

2 Answers 2

1

The simplest thing you can do is install the Demo Templates that come with Calendar. You can do this by going to the Calendar module CP area, and then click on Demo Templates tab. Proceed with the installation there. You'll then be able to see how an average site using Calendar could/should be constructed, how the template tags interact with each other, and what each template tag does. :)

Referencing the Calendar:Events documentation, you can see a proper way to develop your template code, or in your case, generate a list (?) of entries:

<ul>
    {exp:calendar:events
        orderby="title"
        sort="asc"
        date_range_start="today"
        show_months="3"
    }
    <li>
        <a href="{path='calendar/event'}/{event_id}/">
            {event_title}
        </a>
        {event_start_date format="%l, %F %j, %Y"}
    </li>
    {if calendar_no_results}
        <li>No Results</li>
    {/if}
    {/exp:calendar:events}
</ul>

All that said, I have a feeling you MAY be more interested in generating a list of events in chronological order (specifically in the case where you have recurring events). Calendar:Events just displays each event group as 1 result (no matter how many recurrences you have of it), while Calendar:Cal will display ALL of the occurrences, and put them in the right order. If you haven't already, I strongly suggest you check out this documentation page for more information (it explains the differences between these 2 template tags). :)

If you do wish to display a chronological list of occurrences (instead of just event "groupings"), then the code you'd want to use is:

<ul>
{exp:calendar:cal
        date_range_start="today"
        show_months="6"
        pad_short_weeks="n"
}
    <li>
        <a href="{path='calender/event'}/{event_id}/">
            {event_title}
        </a>
        ({event_start_date format="%F %j, %Y"})
    </li>

    {if no_results}
    <li>No Results</li>
    {/if}
{/exp:calendar:cal}
</ul>

And then finally, being that you're linking to the event located at "calendar/event", in your template located at "calendar/event", be sure to have code like the following:

{exp:calendar:events
    orderby="title"
    sort="asc"
    event_id="{segment_3}"
    date_range_start="today"
    show_months="3"
}

    {if calendar_no_results}
        No Results
    {/if}
    <div class="event">
        <h2>{event_title}</h2>
        <p>From Calendar:
            <a href="{path='calendar/calendars'}/{event_calendar_id}/">
                {event_calendar_title}
            </a>
        </p>
        <p>Details:{event_summary}</p>
        <p>Location: {event_location}</p>
        <h3>Upcoming Occurrences in the next 3 months:</h3>
        <ul>
            {occurrences}
            <li>
                <a href="{path='calendar/day'}/{occurrence_start_date format="%Y/%m/%d"}/">
                {occurrence_start_date format="%l, %F %j, %Y at %g:%i%a"}
                </a> - {occurrence_end_date format="%l, %F %j, %Y at %g:%i%a"}
            </li>
            {/occurrences}
        </ul>
    </div>
    <hr />
{/exp:calendar:events}
0

You need to use include the name of your template group and template. Take a look at the path variable:

<a href="{path='channel/archives'}">My Archives Page</a>

You can read more about it here: https://ellislab.com/expressionengine/user-guide/templates/globals/path.html

3
  • But the entries that are retrieved could be coming from 1 to many template groups
    – andrewb
    Feb 12, 2015 at 15:55
  • Not sure what you mean by "coming from" template groups - entries live in channels and are pushed out to different templates. Aren't these calendar entries all displayed using common templates? Feb 13, 2015 at 14:45
  • andrewb, you can't go straight to an entry - you always have to view it via a template.
    – Chego
    Feb 14, 2015 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.