We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

New Datepicker FieldFrame extension

Development and Programming

Michael C. (KKCJ)'s avatar
Michael C. (KKCJ)
100 posts
16 years ago
Michael C. (KKCJ)'s avatar Michael C. (KKCJ)

I’m getting the following PHP warning when the field is blank:

Warning: date() expects parameter 2 to be long, string given in /home/public_html/system/core/core.localize.php on line 794

The line number changes depending on where in a template the offending code appears.

It only seems to appear when a formatting is specified: {date_field format="…"}.

I realize that typically, a solution would be to test for a value in the field, but that’s how I came across the problem in the first place:

{if date_field}
    {date_field format="%Y-%m-%d"}
{if:else}
    No date specified.
{/if}

Apparently, in this situation, the code in the first {if} statement is still run, even though it doesn’t end up getting displayed due to the {if} statement not evaluating to true. Since the code is still run, the PHP warning messages it produces are still displayed at the top of the page code, even though the intended output isn’t.

With an empty date_field, the above code would result in something like this:

Warning: date() expects parameter 2 to be long, string given in /home/public_html/system/core/core.localize.php on line 794
No date specified.

Any ideas?

       
Peter Lewis's avatar
Peter Lewis
280 posts
16 years ago
Peter Lewis's avatar Peter Lewis

Update on KKCJ issue, v1.0.6 resolves this and if no date is set, it returns false, so the if statement now works.

       
Andy_vdG's avatar
Andy_vdG
62 posts
16 years ago
Andy_vdG's avatar Andy_vdG

Trying to use this in FFMatrix for upcoming events. I would like to show the next 5 upcoming events. How would the exp:weblog:entries code look like when I am using a date field in FFMatrix?

Currently I have:

{exp:weblog:entries weblog='events' limit='5' orderby='date' dynamic='off' disable='categories|category_fields|member_data|pagination|trackbacks'}
    {events}
        <div id='event'>
            <b>{date}</b>

            <b>{title}</b>

            {location}

            {desc}
        </div>
    {/events}
{/exp:weblog:entries}

Thanks

EDIT: Code snippet should be:

{exp:weblog:entries weblog='events' dynamic='off' disable='categories|category_fields|member_data|pagination|trackbacks'}
    {events}
        <div id='event'>
            <b>{date}</b>

            <b>{title}</b>

            {location}

            {desc}
        </div>
    {/events}
{/exp:weblog:entries}
       
Peter Lewis's avatar
Peter Lewis
280 posts
16 years ago
Peter Lewis's avatar Peter Lewis

As far as I’m aware, you can’t “orderby” any FF Matrix field as the only way to target the fields is via the FFMatrix container (in your example that’s events).

You couldn’t even do an SQL query as the values of FF Matrix are stored in an array within each cell in the database.

But looking at your code, you’ve got a weblog of events, but then each event has multiple events. So how would you order the weblog events by latest date, when the inner events could vary?

If you had the date field as it’s own field (not inside the FF Matrix), it should work fine.

       
fogcity's avatar
fogcity
260 posts
16 years ago
fogcity's avatar fogcity

After installing Datepicker, whenever I try to create or edit an entry for ANY weblog, I get an out of memory error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 50120 bytes) in /home/public_html/system/extensions/ext.publish_form.php on line 262

I then tried changing this memory allocation in my htaccess file:

php_value memory_limit 128M

didnt work, even when i upped it to 256M.

as soon as i disable FieldFrame, the error goes away.

suggestions?

(running EE 1.6.8, and just downloaded latest versions of this and FieldFrame today)

       
negs's avatar
negs
43 posts
16 years ago
negs's avatar negs
negs: Can you check you’re using the latest version of FieldFrame (v1.3.5 should be fine) and also the latest version of the TBZ DatePicker (v1.0.5). If that doesn’t solve it, PM or email some login details and I’ll take a look.

I was using an older version. I don’t know how that happened. Thanks so much.

UPDATE: Isn’t working - looks like there is a conflict with wygwam. I will PM you. getting this error when I try to add a new date:

Notice: Undefined index: day in /home/xxxx/extensions/fieldtypes/tbz_date/ft.tbz_date.php on line 266

Warning: mktime() expects parameter 4 to be long, string given in /home/xxxx/extensions/fieldtypes/tbz_date/ft.tbz_date.php on line 266

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/extensions/fieldtypes/tbz_date/ft.tbz_date.php:266) in /home/xxxx/extensions/fieldtypes/wygwam/ft.wygwam.php on line 340

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/extensions/fieldtypes/tbz_date/ft.tbz_date.php:266) in /home/xxxx/extensions/fieldtypes/wygwam/ft.wygwam.php on line 341

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/extensions/fieldtypes/tbz_date/ft.tbz_date.php:266) in /home/xxxx/extensions/fieldtypes/wygwam/ft.wygwam.php on line 342

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/extensions/fieldtypes/tbz_date/ft.tbz_date.php:266) in /home/xxxx/extensions/fieldtypes/wygwam/ft.wygwam.php on line 343

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/extensions/fieldtypes/tbz_date/ft.tbz_date.php:266) in /home/xxxx/extensions/fieldtypes/wygwam/ft.wygwam.php on line 344

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/extensions/fieldtypes/tbz_date/ft.tbz_date.php:266) in /home/xxxx/extensions/fieldtypes/wygwam/ft.wygwam.php on line 345

       
Peter Lewis's avatar
Peter Lewis
280 posts
16 years ago
Peter Lewis's avatar Peter Lewis

fogcity: The error is with “/home/public_html/system/extensions/ext.publish_form.php” another extension, but I appreciate it didn’t appear until you installed DatePicker. Doesn’t memory have to be inceased via php.ini rather than htaccess?

negs: I’ve got wygwam installed on one of my builds, but I’ll check out those line numbers when I get a chance. How are you using it? FF Matrix, standalone? If it’s in an FFMatrix, is it alongside a wygwam field?

Peter.

       
Andy_vdG's avatar
Andy_vdG
62 posts
16 years ago
Andy_vdG's avatar Andy_vdG
As far as I’m aware, you can’t “orderby” any FF Matrix field as the only way to target the fields is via the FFMatrix container (in your example that’s events). You couldn’t even do an SQL query as the values of FF Matrix are stored in an array within each cell in the database. But looking at your code, you’ve got a weblog of events, but then each event has multiple events. So how would you order the weblog events by latest date, when the inner events could vary? If you had the date field as it’s own field (not inside the FF Matrix), it should work fine.

Sorry - that was a copy and paste error for my example… I only have one entry in the events weblog which contains all the events within the FFMatrix.

The alternative route would be to go back to one entry per event with a start and end date which I can then use with show_future_entries=”yes” and show_expired=”no” It would just be so much easier to have it in a FFMatrix type layout.

       
Peter Lewis's avatar
Peter Lewis
280 posts
16 years ago
Peter Lewis's avatar Peter Lewis

Andy_vdG: That might be doable then…

FFMatrix has an “order by” parameter, try:

{events orderby="date" sort="desc"}
       
Andy_vdG's avatar
Andy_vdG
62 posts
16 years ago
Andy_vdG's avatar Andy_vdG

Yes it might…

If I can get the

search:speaker_confirmed=”yes” (new) Only loop through rows that match a certain criteria. Mimics the parameter for {exp:weblog:entries}, and supports comparison operators <, >, <=, and >= as well.

functionality working…

How are the dates stored by Datepicker? Could I do something like this:

{events search:date=">={current_time format='%d.%m.%Y'}" orderby='date' sort='asc' limit='5'}

??? (This example doesn’t work! I do have my date set up to be saved in that format though.)

That sir, would be awesome! 😊

       
Peter Lewis's avatar
Peter Lewis
280 posts
16 years ago
Peter Lewis's avatar Peter Lewis

Try:

{events search:date=">={current_time}" orderby='date' sort='asc' limit='5'}

Failing that, try:

{events search:date=">={current_time format='%B'}" orderby='date' sort='asc' limit='5'}

If date isn’t displayed via the usual methods (e.g. it’s directly out of the database, which is what I’m assuming the search parameter is), then it’s in unix timestamp.

       
Andy_vdG's avatar
Andy_vdG
62 posts
16 years ago
Andy_vdG's avatar Andy_vdG
{events search:date=">={current_time}" orderby='date' sort='asc' limit='5'}

worked like a charm. Sweet! Thanks a ton!

       
negs's avatar
negs
43 posts
16 years ago
negs's avatar negs
negs: I’ve got wygwam installed on one of my builds, but I’ll check out those line numbers when I get a chance. How are you using it? FF Matrix, standalone? If it’s in an FFMatrix, is it alongside a wygwam field? Peter.

Ok, I updated Wygwam and it seems to be good. Thanks for the attention.

       
fogcity's avatar
fogcity
260 posts
16 years ago
fogcity's avatar fogcity
fogcity: The error is with “/home/public_html/system/extensions/ext.publish_form.php” another extension, but I appreciate it didn’t appear until you installed DatePicker. Doesn’t memory have to be inceased via php.ini rather than htaccess?

increased memory with php.ini, but didnt help either.

probably a conflict between the two. sadly, Publish Form Extension wins.

       
Michael C. (ProImage)'s avatar
Michael C. (ProImage)
102 posts
16 years ago
Michael C. (ProImage)'s avatar Michael C. (ProImage)
Update on KKCJ issue, v1.0.6 resolves this and if no date is set, it returns false, so the if statement now works.

That seems to have fixed it indeed - thanks! 😊

       
First 2 3 4 5

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.