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.

Need to order entries by channel field input of "Event Start Date:" Rather then the date of the entry

January 27, 2011 8:43pm

Subscribe [4]
  • #1 / Jan 27, 2011 8:43pm

    mgrothman

    10 posts

    Just wondering how I would go about this.

    I want to only show events that are happening in the future rather then events that are already past, and right now the events are all scrambled based on the date they were entered and not the actual date of the event.

    http://worldsavvy.org/events/

    Current Code:

    {exp:structure:paginate parse="inward" show_first_last="no" show_next_previous="yes" class="pagination" location="bottom" show_num_pages="8"}
    {exp:channel:entries channel="{segment_1}" sort="desc" orderby="date" show_future_entries="yes" dynamic="no" limit="3"}


    The date variable being displayed for each entry:

    {events_start_date format="%F %j%S %Y"}
  • #2 / Jan 28, 2011 11:44am

    Ingmar

    29245 posts

    I want to only show events that are happening in the future rather then events that are already past, and right now the events are all scrambled based on the date they were entered and not the actual date of the event.

    It’s usually a good idea to set the entry_date to the actual date of the event. That way you can take advantage of EE’s sorting features most easily. You can also sort by other custom fields, of course. Have you tried this with {events_start_date}?

  • #3 / Jan 28, 2011 1:43pm

    mgrothman

    10 posts

    Unfortunately I took over development on this project so they were the ones who set it up this way??

    As far as your suggestion, that worked for some reason I was using orderby=”{events_start_date}” rather than orderby=“events_start_date”.

    This works correctly for solely the purpose of showing the events in the correct order I want them, but now I can’t get paginate to function properly to only show events that haven’t already passed (start_on wont work cause it references the entry date and not the custom field).

    Also I can’t get the categories to work either with the following code…

    This displays correctly everything I want but breaks with pagination and doesn’t work with the categories

    {exp:channel:entries channel="{segment_1}" sort="desc" orderby="events_start_date" show_future_entries="yes" dynamic="no" paginate="bottom"}
    
    {if events_start_date>current_time}

    I think at this point the best solution would be possibly to somehow sync the entry date to the custom field? Is this possible? Or would they have to manually do it every time they make an entry in the events channel.

  • #4 / Jan 28, 2011 6:06pm

    mgrothman

    10 posts

    So for anyone who runs into this issue, I found a nice solution

    This add on solves the exact issue I was having:
    http://devot-ee.com/add-ons/eevent-helper/

    It syncs any chosen custom field of your events channel to the entry date.

    However I had to manually change all the existing entries entry dates.

  • #5 / Jan 28, 2011 7:22pm

    mgrothman

    10 posts

    So I’m not out of the woods yet. Always something with this site…

    With my new add-on I now can not for the life of me figure out why my featured listing block for the events page is not functioning anymore??

    Works perfectly fine on the blog page (Which calls the same template):
    http://worldsavvy.org/blog/

    but not on the events page:
    http://worldsavvy.org/events/

    Here is the code for the featured listing template:

    <div id="featured_listing">
        <div class="featured_desc">
            <h1>{embed:channel_name}</h1>
            {embed:body_text}
        </div>
        {exp:channel:entries channel="site_settings" entry_id="9" dynamic="no" show_future_entries="yes"}
        {featured_{embed:channel_name} limit="1"}
        <div class="featured_media">
            {if youtube_id}
                    <object width="420" height="238">
                        </param>
                        </param>
                        </param>
                        <embed src="http://www.youtube.com/v/{youtube_id}?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="420" height="238"></embed>
                    </object>
            {if:elseif {embed:channel_name}_image}
                <a href="http://{site_url}{embed:channel_name}/{url_title}/">{exp:imgsizer:size src="{{embed:channel_name}_image}" width="420" height="238" alt="{title}"}</a>
            {/if}
        </div>
        <div class="featured_post">
            <h2><a href="http://{site_url}{embed:channel_name}/{url_title}/">{title}</a></h2>
    <p>        {if "{embed:channel_name}" == "events"}{events_start_date format="%F %j%S %Y"}{if:else}{entry_date format="%F %j%S %Y"}{/if}<br />
            {exp:trunchtml chars="300" inline=" ... " ending="<a href='{site_url}{embed:channel_name}/{url_title}/'>Read More</a>"}{exp:tagstripper:tagsToSave tags="script|span|a"}{{embed:channel_name}_description}{/exp:tagstripper:tagsToSave}{/exp:trunchtml}<br />
        </div><br />
        <div class="clear"></div><!--.clear--><br />
        {/featured_{embed:channel_name}} <br />
        {/exp:channel:entries}<br />
    </div>

    Even when disabling the add-on the featured listing template is still not working properly anymore??

    UPDATE: When I disable the add-on and create a new entry, it is back to functioning properly. Something with the entry date??

  • #6 / Jan 28, 2011 7:55pm

    mgrothman

    10 posts

    SOLUTION:
    I needed a show_future_entries=“yes” in the featured tag as well.

    {featured_{embed:channel_name} limit="1" show_future_entries="yes"}
  • #7 / Jan 30, 2011 10:24am

    Greg Salt

    3988 posts

    Hi mgrothman,

    So, you are all good with this now?

    Cheers

    Greg

  • #8 / Jan 30, 2011 1:27pm

    mgrothman

    10 posts

    Yes, thanks

  • #9 / Jan 31, 2011 1:15pm

    Barry Cogan

    291 posts

    Glad to hear it! 😊 Please post again with any future issues!

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

ExpressionEngine News!

#eecms, #events, #releases