SIERRA Posted July 30, 2020 Share Posted July 30, 2020 Hi, If we create a 'Page' inside processwire we can use the code like '$alertspage=$pages->get(id);' to get the page id etc. But if I create a core php page inside the processwire source (without using PW template), do I have the possibility to access the processwire code like this. If yes, then could you please suggest how. Thanks Link to comment Share on other sites More sharing options...
MoritzLost Posted July 30, 2020 Share Posted July 30, 2020 Yes, this is called bootstrapping, see the documentation. Basically, you only need to include ProcessWire's index.php, then you can use the API as usual. The only difference is that you won't have access to the $page variable, since it's not a regular ProcessWire page request, so ProcessWire can't associate a particular page with it. 4 Link to comment Share on other sites More sharing options...
SIERRA Posted July 31, 2020 Author Share Posted July 31, 2020 Thanks. Hope I can access the configured repeater items inside process wire in my core PHP file. I will check the references Link to comment Share on other sites More sharing options...
MoritzLost Posted July 31, 2020 Share Posted July 31, 2020 Absolutely you can! You just need to get the page the repeater items are on, then you can access the repeater items on it. Based on your code above it should be simple: $id = 1234; // replace with desired page ID $alertspage = $pages->get(id); // replace "alerts" with your repeater field name foreach ($alertspage->alerts as $alert) { // do something with the repeater items ... } 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