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_by="day" issue

January 03, 2008 3:27am

Subscribe [5]
  • #16 / Jan 03, 2008 11:26pm

    Lisa Wess

    20502 posts

    Ok, I suspect what we’re seeing is actually a localization issue.  How important to you is the time of that latest post: “Right on Target” - would you be willing to set its time-stamp a little earlier, say 5 or 6pmish, to see if it shows up in your display_by day?  It can be set back after, this is just a test. =)

  • #17 / Jan 03, 2008 11:30pm

    Andy Morris

    30 posts

    I made that change. I have checked that both the users that are posting have their localization set to time zone they are in ....central.

  • #18 / Jan 03, 2008 11:33pm

    Lisa Wess

    20502 posts

    On your original test template, can you change it back to limit=“1”, and just one instance of the weblog entries tag?

  • #19 / Jan 03, 2008 11:40pm

    Andy Morris

    30 posts

    I did that here

    and it seems to fix the problem. Check out the main template for this and it works as well. here

    However, if I call another day with multiple posts I only get the last post. It is after 9pm central. See it here

    So I localization setting wrong?

  • #20 / Jan 03, 2008 11:48pm

    Lisa Wess

    20502 posts

    That is a really, really neat site.

    Now then, excuse me. =)

    Ok the URL here:

    http://andyandroxanne.net/index.php/site/blog/2007/12/18

    that indicates to EE to show posts for December 18, 2007, so you don’t need or even really want display_by in that one; just let ExpressionEngine do its work. 

    As for localization, have a read through of this kb entry.

  • #21 / Jan 03, 2008 11:58pm

    Andy Morris

    30 posts

    will do and i’ll update here what I have *cough* wrong and maybe this can help others. I’ll also create another template for direct date request since this one (blog) has the display_by parameter in it.

    Just wait till I add recipes and the other about pages…..sadly, I have another client to finish first.

    Thanks for your help. This help today has made the license fee worth it…and i’m convincing people to use EE. I’m going to be buying more licenses. This is a wonderful application with wonderful support personnel.

  • #22 / Jan 04, 2008 1:29am

    Andy Morris

    30 posts

    O.K. There is a problem here. I will have to find out what time zone my server is in. You can see at least for the time being that I have a nice oddity going.

    With the test page the same as before I have changed the post times for 1/2/2008. One is for 02 Jan 2008 16:45, and the other is now at 01 Jan 2008 23:30. Both show up with the EE tag as before. 2 posts with 2 day headings when the EE tag calls for limit=“1”!

    {exp:weblog:entries weblog="blog" display_by="day" limit="1" orderby="date"}

    I’m guessing that while it outputs my date as set in preferences it displays entries based off the server’s time which may be as many as 6 hours off. Instead of figiting with it till i’m exhaused and brain dead i’ll wait until I find out the server’s time.

    My settings are currently as follows:

    Localization: -600 central time
    offset: none
    DST: no
    honor user’s dst: no

    All my user’s localization are set to central time.

    Stay tuned….

  • #23 / Jan 04, 2008 3:45am

    Andy Morris

    30 posts

    So I used the php script on the wiki entry about this and dumped it into a template and allowed it to parse php on input. It gave me this:
    Test of various time/date functions:
    Server
    PHP date: 04Jan08 01:24(echo date(‘dMy h:i’);)
    PHP gmdate: 04Jan08 07:24(echo gmdate(‘dMy h:i’);)
    Database dates(GMT/UTC)
    LOC now: held in db as 1199453053 which is 04Jan08 07:24 (date(‘dMy h:i’,$LOC->now);)
    User
    Users timezone: UM6 ($SESS->userdata[‘timezone’])
    Users Time:2008-01-04 01:24 AM ($LOC->set_human_time();)

    By moving entry time and date around I know that at 6:00pm central time (all DST is off) It displays that entry on another day (even though it displays the date of the entry as the correct day). So if I have an entry at 11:59pm and 6:00pm they both show up. If I change the 6:00pm entry to 5:59pm the second entry doesn’t get displayed. It’s like a new day starts at 6pm, but we still call it the old day until midnight.

    I set the server time to: 0 UTC and offset it by 360. This put the server on the database’s time and pushed EE to offset and show my correct time. For the time being i’m getting my intended results, but I’m betting this has something to do with how the database is storing and retrieving my dates…..i’ll have to coax some time out of one of my PHP/SQL ninja friends.

    Any thoughts anyone?

  • #24 / Jan 04, 2008 4:05pm

    Derek Allard

    3168 posts

    Hey Posquali… you’ve stumbled into one of my least favourite things about the internet here… timezones.  As you can tell from the kb article, its kind of “wild west” out there. 😊

    Something that I think may work for you.  Could you set

    CP Home  ›  Admin  ›  System Preferences  ›  Localization Settings  ›  Server Time Zone

    (UTC + 6:00) Almaty, Colombo, Dhaka and set your server offset to “0”.

    If that doesn’t work, your solution to use the large offset would make sense, but I’m hopeful that it won’t be needed.  Let me know what that gives us.

  • #25 / Jan 04, 2008 8:18pm

    Andy Morris

    30 posts

    I’ll give that a try. The large offset fixes my display issue but jacks up the time shown in the control panel.

  • #26 / Jan 04, 2008 8:43pm

    Andy Morris

    30 posts

    With that change made it has put the times in my control panel back into reason, but the issue with it displaying only the latest entry after 6pm by itself still exists.

    I do have another install of EE running on another shared hosting server and I cannot replicate the problem there.

    I guess Derek what I’m trying to wrap my head around it that EE uses one date to determine if an entry should be displayed. Then it uses another to output the date shown on the screen. Is that right?

    If so where do the two different processes get their date from? For instance if the determination of if an entry is displayed comes from the database and it has been written in GMT and the process of outputting the date to html comes from PHP parsing that date how can I get them on the same page? Can I make a change to the SQL server or PHP running on my server?

    What is totally puzzling is that the server is set to central time. I’m in central time. All the users are set to central time. The only thing that I gather is not is the database stores all dates in GMT. Isn’t that normal? I’m not a PHP or SQL person. I’ve taught myself HTML from web resources and while i’m not an old dog that can’t learn new tricks the learning curve is pretty steep.

    Ideas on where I should direct those who run my web host?

  • #27 / Jan 06, 2008 1:29pm

    Robin Sowell

    13255 posts

    posquali, I’m double checking this one for you.  It’s complicated, but looks to me like the select for displya_by day isn’t localized.  It’s pulling based on gmt d/m/y- the standard entry_date variable would be localized- hence the difference.  But I need to clarify- as that code is thick.

  • #28 / Jan 06, 2008 4:44pm

    Andy Morris

    30 posts

    Many Thanks.

  • #29 / Jan 06, 2008 11:38pm

    Derek Allard

    3168 posts

    With that change made it has put the times in my control panel back into reason, but the issue with it displaying only the latest entry after 6pm by itself still exists.

    Could you try editing an entry and resettitng its time to 4pm, and then back to 6pm for me? 

    If that doesn’t work, just to be sure I’ve got eveything straight, could you in a single sentence explain to me what you want to happen?  Also, can you share the minimal template that shows us your problem?  The fact that its working (presumably same code, localization settings etc) only highlights the inconsistencies across various servers.  This is a very problematic area for us because of all the different possibilities.

    I guess Derek what I’m trying to wrap my head around it that EE uses one date to determine if an entry should be displayed. Then it uses another to output the date shown on the screen. Is that right?

    display_by is kind of an exception to the rule.  In general, EE will use the same date information to determine both whether an entry is appropriate for display and (if it is) what date to show.  In order to group by day, month or year in a way that is performance friendly, we also store those pieces of info discretely.  You can see all these in your weblog_titles table if you’re interested (entry_date, day, month, year).  Entry date is fist localized, and then day, month and year information is extracted from there.  So they should all be the same.  Because of this, in order to get this working “correctly” we’ll need to get the localization working.  It just might be ultra tricky.

    Your issue is clearly that your server is somehow off by 6 hours, so after 6pm it thinks an entry is the following day.  We should be able to fix this up for you.

    What is totally puzzling is that the server is set to central time. I’m in central time. All the users are set to central time. The only thing that I gather is not is the database stores all dates in GMT. Isn’t that normal?

    Correct.  The date information of the database should be irrelevent here, correct.  It’ll only matter what time the server is at, and the users localization information at that moment.

  • #30 / Jan 07, 2008 1:28pm

    Andy Morris

    30 posts

    O.K. Here is the link to the minimal template. This was setup by Lisa, and i’ve adjusted it only to show what I want displayed.

    http://andyandroxanne.net/index.php/site/lisa_test/

    The last post available is title “A New Year, A New Car”. I had it set for 11:30pm. My user is localized to central time. I reset it to 4:00pm. I then moved it back to after 6pm. I set it to 6pm exactly. When I checked my minimal template after i moved it to 4pm both it and the other entry on that day displayed. That is correct. When I moved it to 6pm. Only that entry “a new year, a new car” was displayed again.

    My intended result is for any entries from midnight to midnight display on my main blog page using the display_by=“day” parameter. Right now that does not happen if two entries are on either side of the 6pm hour.

    I hope that give you a clear picture of everything. Let me know if it’s not. I’m off and on conference calls, but i’ll do my best to stay close if you have other questions.

    thanks again.

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

ExpressionEngine News!

#eecms, #events, #releases