Jump to content

JSON Feed to Update Processwire


dps123
 Share

Recommended Posts

Hi,

I have a JSON feed that I need to grab and update some pages and fields within ProcessWire. I've created a template with my code that I am going to use. I have fallen at the first hurdle though. I need to first select the pages that are using my specific template as those are the ones that I need to update with the JSON data. When I do this:

$my_pages = $pages->find("template=my_template");

Error: Call to a member function find() on a non-object

Could someone point me in the right direction?

Thanks!

Link to comment
Share on other sites

If you haven't, you can read a bit in the docs here: https://processwire.com/api/modules/

Depending on what your module / class has extended, you may also use $this->pages->find()

And if you use procedural functions, you can use

function myFunction() {
    $pages = wire('pages');
    $pages->find();
    ...
Edited by horst
  • Like 3
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

×
×
  • Create New...