Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2020-06-08 17:21:12

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

Re: strftime unix %s doesn't works on localhost

There are symlinks for PHP 7.3 and PHP 7.4, so try that again with:

php73 -r "echo strftime('%s', '1591628404');"
php74 -r "echo strftime('%s', '1591628404');"

Last edited by gaekwad (2020-06-08 17:22:04)

Offline

#26 2020-06-08 17:24:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,436
Website GitHub

Re: strftime unix %s doesn't works on localhost

Both -1.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#27 2020-06-08 17:25:09

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,241
GitHub

Re: strftime unix %s doesn't works on localhost

Time to compare phpinfo()? I’m around for the evening, just waiting on stuff to compile.

Offline

#28 2020-06-08 17:26:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,436
Website GitHub

Re: strftime unix %s doesn't works on localhost

gaekwad wrote #323658:

Time to compare phpinfo()? I’m around for the evening, just waiting on stuff to compile.

I’ll show you mine if you show me yours ;)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#29 2020-06-08 20:48:38

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

Re: strftime unix %s doesn't works on localhost

Bloke wrote #323635:

Thanks for the report. In the meantime, this will get you the current article timstamp:

<txp:php>global $thisarticle; echo $thisarticle['posted'];</txp:php>...

Cool thanks, where can I find the full documentation about the $thisarticle and all the other cool friends please?

BTW if you already working on solving this, then it also the same in all other date related tags as:
<txp:posted />
<txp:expires />
<txp:image_date />
<txp:image_info />
<txp:file_download_created />

Offline

#30 2020-06-08 21:29:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,436
Website GitHub

Re: strftime unix %s doesn't works on localhost

Yeah, they all use our safe_strftime() function, which is basically a piggyback to PHP’s strftime() with the timezone/gmt offsets added to it. So any tag that uses any such time-based info will be affected.

Trying to zero in on the problem. We’ve ruled out a lot of things, but have yet to find the root cause.

btw, the easiest way to find out about the various $this strings is to import them from the global scope and just dmp(); them on your page, maybe in your default form. You can see how they react as you navigate around the front end.

These are the most fun ones, some of which are context dependent (so will return null unless you’re in a <txp:images> or <txp:file_download_list> or <txp:linklist> container, etc):

global $pretext,
    $thisarticle,
    $thissection,
    $thiscategory,
    $thispage,
    $thislink,
    $thisimage,
    $thisfile,
    $thisauthor;

dmp('TXP CONTEXT', $pretext);
dmp('CURRENT ARTICLE', $thisarticle);
dmp('CURRENT IMAGE', $thisimage);
dmp('CURRENT FILE', $thisfile);
dmp('CURRENT LINK', $thislink);
dmp('CURRENT SECTION', $thissection);
dmp('CURRENT URL CATEGORY', $thiscategory);
dmp('CURRENT URL AUTHOR', $thisauthor);
dmp('CURRENT URL PAGINATION', $thispage);

They’re probably documented somewhere, but if not, you’re right, they should be. I’ll check as we iterate the documentation for 4.8.

Last edited by Bloke (2020-06-08 21:41:46)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#31 2020-06-09 08:02:51

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

Re: strftime unix %s doesn't works on localhost

Bloke wrote #323662:

They’re probably documented somewhere, but if not, you’re right, they should be. I’ll check as we iterate the documentation for 4.8.

Thanks a lot this is a really useful stuff, always great to learn more TXP love 🤗

Offline

#32 2020-06-09 09:12:37

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,436
Website GitHub

Re: strftime unix %s doesn't works on localhost

After going round in circles and plenty of head scratching, my sleuthing accomplice and I have decided to just work around this issues instead of trying to fathom why it happens.

Should be patched in this commit.

Thanks for all your help on this one, Mr Cooper.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB