Tyssen Posted February 11, 2019 Share Posted February 11, 2019 I'm using a single page template with Name format for children filled in with date(U) so the children have their name field automatically filled with the UNIX timestamp, but when I save entries it's coming out in the format 11am28australia-brisbane-1549849103. How do I only get the time stamp at the end? Link to comment Share on other sites More sharing options...
PWaddict Posted February 11, 2019 Share Posted February 11, 2019 date(U) is working fine for me. It only adds the timestamp although I have installed ProcessSetupPageName module which expands "Name format for children". If you want try it but before that double check that you're using ONLY date(U) on "Name format for children". Maybe you have a custom hook forgotten on init.php or ready.php that manipulates the name on that template? Link to comment Share on other sites More sharing options...
Tyssen Posted February 12, 2019 Author Share Posted February 12, 2019 I'd actually installed the SetupPageName module before I realised there was a native name format for children field but with it installed, I got errors when trying to add new pages, so I installed it. But I wonder if it's done something which is causing this behaviour? Oh, and I don't have anything in init or ready which would be causing it. Link to comment Share on other sites More sharing options...
PWaddict Posted February 12, 2019 Share Posted February 12, 2019 If the output of the name is 11am28australia-brisbane-1549849103 you obviously using more options in "Name format for children" than just "date(U)". For example how "Australia" or "Brisbane" injected? Link to comment Share on other sites More sharing options...
Tyssen Posted February 12, 2019 Author Share Posted February 12, 2019 That's what I can't work out, because date(U) is all that's there. Link to comment Share on other sites More sharing options...
PWaddict Posted February 12, 2019 Share Posted February 12, 2019 If you replace "date(U)" with just the string "test" what will be the result? Link to comment Share on other sites More sharing options...
Tyssen Posted February 12, 2019 Author Share Posted February 12, 2019 I get a page named 'test'. Link to comment Share on other sites More sharing options...
Tyssen Posted February 12, 2019 Author Share Posted February 12, 2019 I also tested "string".date(U) and got tue-12-feb-2019-15-30-03-1000australia-brisbane2019-02-12t15-30-03-10-0003pmtue-12-feb-2019-15-30-03-10003australia-brisban ? Link to comment Share on other sites More sharing options...
PWaddict Posted February 12, 2019 Share Posted February 12, 2019 Are you testing it in a multi-language site? Maybe the locale is causing this issue. Link to comment Share on other sites More sharing options...
Tyssen Posted February 12, 2019 Author Share Posted February 12, 2019 No, single language. But just in case, where would that be set? Link to comment Share on other sites More sharing options...
Robin S Posted February 12, 2019 Share Posted February 12, 2019 On 2/11/2019 at 2:50 PM, Tyssen said: I'm using a single page template with Name format for children filled in with date(U) From the documentation for "Name format for children": Quote If you want your page names to reflect the created date/time: Enter a PHP date format for the value of your name format. Your date format must include at least one non-alphanumeric character (like a slash "/" or colon ":" for example) in order to be recognized as a date format. Example: "Y/m/d H:i:s" would result in page names like: "2014-10-30-12-39-01". As you can see, non-alphanumeric characters still present in a formatted date are converted to hyphens. So if you want date format "U" you would enter that along with at least one non-alphanumeric character - e.g. "/U" or "U/". Do not enter "date()" anywhere in the format. ProcessSetupPageName is not the same as the core "Name format for children" feature and it has different format requirements. 2 1 Link to comment Share on other sites More sharing options...
Tyssen Posted February 12, 2019 Author Share Posted February 12, 2019 Yep, that did it. In all the Googling I've done on how to do this, that page in the docs never came up. The ProcessSetupPageName module did though which is why I attempted to use that first. Link to comment Share on other sites More sharing options...
PWaddict Posted February 12, 2019 Share Posted February 12, 2019 4 minutes ago, Tyssen said: In all the Googling I've done on how to do this, that page in the docs never came up. If I remember correctly, on the notes of "Name format for children" should have a "More" link that leads to documentation. At least this is how it's done with the ProcessSetupPageName module. 1 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