patzer Posted May 26, 2013 Share Posted May 26, 2013 Can I pull data from a field on a different page? If so, how? Thanks! Link to comment Share on other sites More sharing options...
diogo Posted May 26, 2013 Share Posted May 26, 2013 Of course you can... $pages->get(page_ID)->name_of_field 1 Link to comment Share on other sites More sharing options...
patzer Posted May 26, 2013 Author Share Posted May 26, 2013 Great! Works perfectly. How can I easily find the page_ID of any page? (1 is obvious, but maybe not the others?) Link to comment Share on other sites More sharing options...
Macrura Posted May 27, 2013 Share Posted May 27, 2013 you can look in the browser URL when you roll the mouse over the edit link for a page; 1 Link to comment Share on other sites More sharing options...
kongondo Posted May 27, 2013 Share Posted May 27, 2013 Just so you know....you are not limited to getting the field by getting the other page by its ID...(though that's easiest and safest because it doesn't change...)....you can get it by path, name, title.... Link to comment Share on other sites More sharing options...
diogo Posted May 27, 2013 Share Posted May 27, 2013 Study the cheatsheet, especially the $pages and Selectors parts http://cheatsheet.processwire.com/ Link to comment Share on other sites More sharing options...
ryan Posted May 29, 2013 Share Posted May 29, 2013 I almost never pull pages by ID. The whole readability factor of $pages->get('/path/to/page/'); is well worth the compromise for me most of the time. But it's true that using ID is more bulletproof because it'll keep working even if you later move the page. But I usually choose readability (and I don't move stuff around very often). 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