Jump to content

Recommended Posts

Posted

Hi everyone,

i just started working with processWire recently. It's an awesome and very powerful cms. I'm currently working on my father's site: relaunch.skulptour.eu for which i used ryan's basic blog profile and adapted it to my needs. Yet it's all developing quite well and fast.

today i though i'd like to have a small info paragraph at the very bottom of the footer - something like "last updated 14. January 2014". i know that i can set date fields, just like in the blog posts, but isn't there a smarter way? maybe there are some PW internal functions i can call?

i'd appreciate to hear some of your ideas!

-- topada

Posted

I think something like this should do what you want:

echo date("j. F Y", $pages->get("sort=-modified")->modified);

It finds the last modified page. You can of course change this to created and also limit to various templates, parents, etc if you want.

  • Like 6
Posted

@adrian: Thank you! that worked like a charme! i thought there must be an easier way than to add a date field to every single page :D next time i'll come up with a more complex question :)

  • Like 1
Posted

Adrian's code shows you the date of the last updated page in the site (which may or may not be the current page being viewed). If you instead want to show the date that the current page being viewed by the user was last updated, you'd do this instead:

echo date("j. F Y", $page->modified);

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...