Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How do I…?
  3. » Txp:posted

#1 2009-02-25 19:51:47

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Txp:posted

Hi I’m trying to add the suffix ST, RD, ND to my days using the Txp:posted tag.

I have come across this code: <?php function &daySufix ($dayNumber = false){ (string) $dayNumber = (!$dayNumber) ? strftime (“%#d”) : $dayNumber; $sufixes = Array (“1” => “st”, “2” => “nd”, “3” => “rd”); return (isset ($sufixes[$dayNumber])) ? $sufixes[$dayNumber] : “th”; }
?>

Use it as follow:

<?php echo strftime (“%A, %b. %#d” . daySufix() . “ %Y”);
?>

How would I use this with Txp:posted? Or would you have to custom code your own PHP to get the suffix? I tried the above, but it complained that the daySuffix was already declared in taghandlers.php

Found this: http://forum.textpattern.com/viewtopic.php?id=29744

Last edited by driz (2009-02-25 20:18:20)


~ Cameron

Offline

  1. Index
  2. » How do I…?
  3. » Txp:posted

Board footer

Powered by FluxBB