nixsofar Posted October 13, 2015 Share Posted October 13, 2015 Hi!New to Processwire, built one site with it and a great big fan already.Not that it was too hard to figure this one out, but where in the reference docs would I find the syntax of $newpage = $pages->add ( template, parent, url, array ( field => content, ... ) besides the generic $a->add($item)?Don't want to miss anything similar Link to comment Share on other sites More sharing options...
Orkun Posted October 13, 2015 Share Posted October 13, 2015 I think you want to add new Pages via the API? Here are some Threads: https://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/ https://processwire.com/talk/topic/352-creating-pages-via-api/ Link to comment Share on other sites More sharing options...
bernhard Posted October 13, 2015 Share Posted October 13, 2015 hi nixsofar and welcome to the forum you are right, $pages->add is not listed in the api docs: https://processwire.com/api/variables/pages/ for now i think it is always the best to look directly into the code if you want to be 100% sure not to miss anything. it's all well commented and both the docs and the cheatsheet are not always complete imho... back to your question: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Pages.php#L600 and of course searching processwire via google can often be helpful: https://processwire.com/talk/topic/6196-easy-search-on-pw-forums-with-google/?p=60632 happy coding Link to comment Share on other sites More sharing options...
nixsofar Posted October 13, 2015 Author Share Posted October 13, 2015 Thanks for your answers! And the hint about the google search. Unfortunately, it doesn't deliver any result for $pages->add (except this very post here.)Highly praised as the API cheatsheet is everywhere, I'd really suggest either to keep it exhaustive or to add a notice that it isn't.Asking newbies to dig in the source code for extremely convenient functions like this is not really an option in my eyes.Just my opinion. Still very excited and thankful about PW! Link to comment Share on other sites More sharing options...
bernhard Posted October 14, 2015 Share Posted October 14, 2015 my hint about google search was more a general one i agree with you that it should be kept up to date but i also know how well it is documented coming from joomla/seblod (that was a pain ). and of course you will always find a helping hand in the forum. maybe not the answer you wanted to hear but i think your point is known one and i think i've already read about plans to overhaul the docs/site structure of processwire. don't think it has priority though and i don't think it should have as the level we have is really good even if it's not perfect... 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