Search

Hi folks, was wondering if you could help...

I currently have a Text Input field within a section titled ‘Date’ and just like the name suggests it’s for the user to input a date in the following format: 19/12/2011

My question is, when this field entry is displayed on my page I would like it to be placed in one of two areas based on whether the date the user has entered is in the past or future.

Example:

Upcoming: 28/11/2011, 04/12/2011

Previous: 09/06/2011, 02/03/2011

Not too sure how I would go about this... In PHP it’s not so much of a problem for me but this I’m finding tricky,

Any help would be great,

First, you have to use the Date field instead of a simple Text Input field.

After changing that create the two Data Sources "Upcoming" and "Previous" and filter both by that Date field. The first DS should filter by later than {$today}, the second one by earlier than {$today}.

Fantastic, thanks phoque, I did originally use Date field however the output format was like: 2011/06/21 so I scrapped it, any idea how I would change this to the UK time format of 21/06/2011?

You can change the format it in your config.php. Look for the ###### REGION ##### section.

I believe your date fields won't get migrated though; you have to make a final decision before you're adding your content.

Use the xslt utility to alter the output of the date time field in xslt: Format Date Utility

Curious to what you is building blad! :)

So you could do it like this...

Make sure you include the date-time.xsl in your template Then place this code in your xsl:

<xsl:template name="format-date">
    <xsl:param name="date" select"XPATH/to/your/date-field-entry"/>
    <xsl:param name="format" select="'D M, Y'"/>
 </xsl:template>

I think that's correct, haven't used it in a while!

Right, the config.php settings are only for the backend.

Awesome guys, thanks for the help, can now put this project to bed,

Moonoo, will fill you in the moro :-)

Yeh man! I'm intreagued now :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details