cssabc123 Posted September 28, 2015 Share Posted September 28, 2015 Unlike the tutorial example HelloWorlds (http://processwire.com/docs/tutorials/hello-worlds/) about the planets Earth and Jupiter. Is there a way to pass data to a Processwire page coming from 1) MySQL database or 2) Another Processwire page? That way I can have a database table of planets and just create one or two pages. One page if I had a dropdown of planets then output planet data on same page when a planet is chosen from the dropdown. Maybe 2 pages if I implement a holder/page pattern where the holderpage will have links of planets, and once a planet link is clicked, fetch planet data from the database for info then output fetch data to a detail page? Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 28, 2015 Share Posted September 28, 2015 Welcome to ProcessWire cssabc123, You interact with data in ProcessWire via the fields from a page. A page in ProcessWire has custom fields (where the data is). Every Page in ProcessWire is build from a template, that template tells the Page which fields the page has. In fact a template is a 'template' for a Page, you could call it a Page factory. Every template can have a template file. (the files in /site/templates/). When a Page has a template with a template file the page can be shown in the browser. When a Page is build from a template that has no template file, the Page can only be used as data container. But how do I get the data from an other Page you might think. That is where the $pages variable comes in. Go ahead and check out the docs. 1 Link to comment Share on other sites More sharing options...
nanook Posted September 28, 2015 Share Posted September 28, 2015 Hey Martijn and cssabc123,First post here. I've been with ProcessWire for exactly two days now. I'm coming from an ExpressionEngine, concrete5 and MVC (CakePHP mostly) background.Just checking if I understand you correctly, Martijn. To enter all the planets, one might create pages in the Tree with a template "planet", which would constitue one's dataset (or container) of planet data. Then, on any given page, you could for instance create a listing or a dropdown via $pages->find("template='planet', sort=title").(That would remind me most of ExpressionEngine, where the data you enter into a channel can be output anywhere you like with {exp:channel:entries channel="planets"})So in this case, the planet pages would not really constitute pages as such (although they might), but a set of data. Rows in a database, if you will.Just wrapping my head around stuff. Bye... Nico Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 28, 2015 Share Posted September 28, 2015 (edited) Just checking if I understand you correctly, Martijn. To enter all the planets, one might create pages in the Tree with a template "planet", which would constitue one's dataset (or container) of planet data. Then, on any given page, you could for instance create a listing or a dropdown via $pages->find("template='planet', sort=title") You got it... You could think that it's a row in the database but that's not the case. (Dive in MySQL to find out) Every field is stored separately with the ID of the page. So ProcessWire makes joins (indexed) to give you all the data back what you're asking ProcessWire. So Loading a page and calling the title will only load the title, leaving the other fields alone... ..... silly me... Welcome Nanook ! Edited September 28, 2015 by Martijn Geerts say hi to nanook.. 5 Link to comment Share on other sites More sharing options...
adrian Posted September 29, 2015 Share Posted September 29, 2015 Is there a way to pass data to a Processwire page coming from 1) MySQL database or 2) Another Processwire page? Not sure your exact needs, but this module might also be of use: http://modules.processwire.com/modules/fieldtype-select-ext-option/ - it allows you to generate a dropdown/radio/checkboxes etc from an external database table. 1 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