Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2023-04-05 09:51:23

Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,024

Re: [Solved] Ugly code: how to improve it?

etc wrote #335269:

But this does not feel very clean, so a new <txp:date /> tag would be better, perhaps?

I would support that, rather that overloading an attribute.

Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern


#14 2023-07-26 09:44:59

Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,595
GitHub Twitter

Re: [Solved] Ugly code: how to improve it?

For you interest. Finally, based on this post by Bloke (see here), I use the new feature to associate some PHP functions (strtotime,date) to the <txp:evaluate /> tag.

Devs, do you think that’s a good approach?

<txp:variable name="now" value='time()' />
<txp:article_custom section="my-section" time="future" limit="1" precommande sort="LastMod desc">
    <txp:evaluate query='strtotime(date("Y-m-d", strtotime("-5 days", <txp:posted format="%s" />))) <= <txp:variable name="now" escape="integer" />'>Hurry up!</txp:evaluate>

Last edited by Pat64 (2023-07-26 09:47:53)


Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.


Board footer

Powered by FluxBB