leoric Posted January 13, 2014 Share Posted January 13, 2014 name*Any combination of letters (a-z), numbers (0-9), dashes or underscores (no spaces).i use chinese language, i have to translated page title to english every time. its a problem for me if it could be this? when i dont type anything in this option system automatic insert the id(the last page id +1 ) is there have some solutions? thank you. Link to comment Share on other sites More sharing options...
adrian Posted January 13, 2014 Share Posted January 13, 2014 This should be fairly easy to do with a simple module. These two posts should get you going: There are several different possible methods detailed in here: http://processwire.com/talk/topic/1908-automatically-generating-new-page-names/ This post is less relevant since it is for pages created with the API, but might be worth a read still: http://processwire.com/talk/topic/4571-id-based-slug-instead-of-title/ 1 Link to comment Share on other sites More sharing options...
leoric Posted January 14, 2014 Author Share Posted January 14, 2014 thank you,adrian , your reply is very helpful.. and thanks for ryan in here: http://processwire.com/talk/topic/1908-automatically-generating-new-page-names/?p=17887 i do this and get what i want: open "wire\modules\process\ProcessPageAdd\ProcessPageAdd.module": find this : "public function init()" and add this line $this->addHookBefore('InputfieldPageName::render', $this, 'hookRender'); then add this function in this class: public function hookRender(HookEvent $event) { if($this->process != 'ProcessPageAdd') return; $id=$this->pages->find("include=all")->last()->id+1; //get the latest id $inputfield = $event->object; if(strlen($inputfield->attr('value'))) return; $inputfield->attr('value', $id); } ok,that's all. thank you everyone! Link to comment Share on other sites More sharing options...
adrian Posted January 14, 2014 Share Posted January 14, 2014 Glad to help. Just one thing - from what you describe, it sounds like you are editing the core ProcessPageAdd module. You don't want to do this, because you'll have to make these changes again every time you upgrade PW. Instead you should create your own simple module using that code. Read here for a tutorial on creating your own module: http://wiki.processwire.com/index.php/Module_Creation 2 Link to comment Share on other sites More sharing options...
leoric Posted January 14, 2014 Author Share Posted January 14, 2014 Glad to help. Just one thing - from what you describe, it sounds like you are editing the core ProcessPageAdd module. You don't want to do this, because you'll have to make these changes again every time you upgrade PW. Instead you should create your own simple module using that code. Read here for a tutorial on creating your own module: http://wiki.processwire.com/index.php/Module_Creation wow, it's so cool.......i'm very very happy... yes,i did it. this is my first time to make a module. thank you very much,adrian . 2 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