Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-08-31 10:29:44

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

txp:hide - date attributes 'showstart' and 'showend'

Well, txp:hide has no attributes which is a bad thing :)

Issue: I am currently looking for a solution to show blocks of content inside of an article only for a certain time.

The best solution in TXP core IMHO would be to add ‘start’ and ‘end’ attributes to the existing txp:hide tag.
As the tag itself is negative – hide instead of show – the attributes need a positive wording.
Sidenote: Maybe we need a txp:show or txp:if_date tag.
That’s why I made up the txp:hide date attributes ‘showstart’ and ‘showend’.

  • showstart a date YYYYMMDDhhmm.
  • showend (dito)
  • Note: I was thinking about the values: past, future, or any (both past and future) like in txp:article but came to no conclusion if this makes sense.

Optional attributes as two still aren’t enough :)

  • test will parse and render the output but inside an HTML comment
  • comment will add an HTML comment above/around the output showing showstart and showend dates.

What else?

Last edited by merz1 (2010-08-31 10:36:40)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#2 2010-08-31 10:43:31

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

Re: txp:hide - date attributes 'showstart' and 'showend'

This is probably better as a plugin imo. Pretty easy to do.

EDIT: maybe smd_if can do it? If {time} between {start} and {end}…

Last edited by Bloke (2010-08-31 10:45:42)


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

#3 2010-08-31 12:18:22

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: txp:hide - date attributes 'showstart' and 'showend'

This is probably better as a plugin imo. Pretty easy to do.

Date functions are pretty much absent on business in Textpattern. I think an if_date tag (or the mentioned hide attributes) is really missing.

Esoteric (?): If I write an article about an upcoming event I would really love to see a countdown realized by a TXP tag txp:countdown which vanishes automagically :)

maybe smd_if can do it?

Well, a CMS should have at least basic date functions in core IMHO.

PS & OT dev hint: And I really miss a ‘mobile design’ plug-in like WordPress seems to offer everywhere.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#4 2010-08-31 12:30:24

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

Re: txp:hide - date attributes 'showstart' and 'showend'

merz1 wrote:

an if_date tag (or the mentioned hide attributes) is really missing.

Hmmm, thinking about it further, perhaps it’s not so easy to do. Date handling is such a sticky subject. Would such a conditional refer to the server’s date of the article (including timezone shift or not?) or does it refer to the time “now” — and is that the server’s ‘now’ or the user’s ‘now’, and does it take DST into account? You’d need a way to specify all this in the tag and it gets very confusing, very quickly.

Since TXP’s internal time handling is slightly, ummm, awkward (I’m getting my head round it slowly) and PHP’s timezone handling is gradually improving, there may come a day when the two converge and dates and times can be an easy subject. Until then I’m not comfortable tackling it [look at the mess I made of smd_calendar… which I’m still unpicking to this day!]

If I write an article about an upcoming event I would really love to see a countdown realized by a TXP tag

You mean like smd_countdown?


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

#5 2010-08-31 14:12:41

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: txp:hide - date attributes 'showstart' and 'showend'

merz1 wrote:
an if_date tag (or the mentioned hide attributes) is really missing.

Bloke wrote:
Hmmm, thinking about it further, perhaps it’s not so easy to do. (… complex & typical ‘Bloke’ driven experiences with multiple times & spaces deleted :)

Well, the first step would be to implement it in a simple & sturdy way and then wait for the complaints aka bug reports to roll in.

Until then a this is not rocket science time calculation it’s only a bloke style try titled remark hidden inside the tag description can help to fight off those well known bellyachers :)

For me a day value/measurement in the fuzzy sense of a wiggling server time is more than enough to make me happy. Or And you can add an offset attribute to the list too.

PS: In my case I would only use YYYYMMDD anyway. But you should of course consider the 99991231 rollover effects.

merz1 wrote:
If I write an article about an upcoming event I would really love to see a countdown realized by a TXP tag

Bloke wrote:
You mean like smd_countdown?

8-O

This tells me again to search for everything first.

Last edited by merz1 (2010-08-31 14:29:36)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#6 2010-08-31 20:14:15

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: txp:hide - date attributes 'showstart' and 'showend'

Would ras_if_dates help you any here?

Offline

#7 2010-09-01 07:34:47

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: txp:hide - date attributes 'showstart' and 'showend'

Thanks Rick for the tip,

I will check your plug-in later but my feature request for basic date functions is aimed at TXP core.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB