Jump to content

Where to find $pages->add in the docs


nixsofar
 Share

Recommended Posts

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

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

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

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

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
 Share

  • Recently Browsing   0 members

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