topada Posted January 16, 2014 Share Posted January 16, 2014 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 Link to comment Share on other sites More sharing options...
adrian Posted January 16, 2014 Share Posted January 16, 2014 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. 6 Link to comment Share on other sites More sharing options...
topada Posted January 17, 2014 Author Share Posted January 17, 2014 @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 next time i'll come up with a more complex question 1 Link to comment Share on other sites More sharing options...
ryan Posted January 18, 2014 Share Posted January 18, 2014 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); Link to comment Share on other sites More sharing options...
cstevensjr Posted January 18, 2014 Share Posted January 18, 2014 @Adrian and @Ryan - Thanks, your code came in handy for a project I'm currently working on. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now