modxcms.com
JIRA
Help
Search
Login
Register
Search
Sign In
Username
Password
Forgot Password?
Not registered yet? Sign up!
Close
MODx CMS
MODx Community Forums
/
Development & Coding
/
Module, Plugin & Snippet Creation and Modification
/
EditedOn instead of DateTime
« previous
next »
Topic: EditedOn instead of DateTime (Read 1535 times)
Print
Pages: [
1
]
Go Down
#1: 2-Oct-2006, 08:27 AM
wybelution
Posts: 2
EditedOn instead of DateTime
In the current template I use the top of each page shows the current date & time using snippet DateTime. Instead of the actual date & time, I would like to show the published date/time or the edited date / time. So I created a new snippet called UpDateTime that has the following code (and of course, this snippet is called instead of the DateTime snippet in the Default Template code):
if($pub_date > 0 ) {
$timestamp = $pub_date ;
} else {
$timestamp = $editedon ;
}
return strftime("%d-%m-%Y %H:%M:%S", $timestamp);
Unfortunately, this always returns "0" (or actually: Jan 1st 1970, 00:00 )
Q: how can I do this the right way?
#2: 2-Oct-2006, 09:24 AM
Pont
Posts: 148
Re: EditedOn instead of DateTime
You are not using the right variables. Use this form
Code:
$timestamp = $modx->documentObject['editedon'];
And you could
look here
for more inspiration.
#3: 2-Oct-2006, 12:43 PM
Marketing & Design Team
davidm
MODx evangelist
Posts: 7,073
The best way to predict the future is to invent it
Re: EditedOn instead of DateTime
You could also check out the
PHx Plugin
Quote
PHx (Placeholders Xtended) will add the capability of output modifiers when using placeholders, template variables and settings tags. It also supports nested tags.
.:
nodeo.net
: Pour un web libre, moderne et ouvert ! ::
david-molliere.net
:
Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web
:.
***
Forums modxcms.fr
Participez à l'élaboration du site MODx francophone !
***
! Nouveau !
En live, ne manquez pas les news de modxcms.fr sur Twitter
! Nouveau !
MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.
Config :
Apache 2.2.8 - MySQL 5.0.67 - PHP 5.2.8 | Debian 4.0 (Etch)
Réalisations sous MODx :
|
pargade-notaires.fr
|
soleil.info
|
gican.asso.fr
|
michelez-notaires.com
|
amadom.gerondicap.com
|
jocelyne-violet.net
#4: 2-Oct-2006, 01:03 PM
wybelution
Posts: 2
Re: EditedOn instead of DateTime
thnx a million!
that really helped
(and I understand the modx variables a lot better now!)
Pages: [
1
]
Go Up
Print
0 Members and 1 Guest are viewing this topic.
Loading...