Manol Posted May 9, 2013 Share Posted May 9, 2013 Hello. 1.- I have created: field type: page input type: checkboxes* label field*: title of the page 2.- the structure of this pages are like this: title: maths , category: 10 title: language , category:11 3.- Is it possible to select from the checkboxes dropdown lets say "maths" and write "10" to the DB ?. Thank you. Link to comment Share on other sites More sharing options...
Soma Posted May 9, 2013 Share Posted May 9, 2013 A page field always saves the page id of the selected page, there's no way to save another value. After all it's just a relation with from page id to page id. 1 Link to comment Share on other sites More sharing options...
teppo Posted May 9, 2013 Share Posted May 9, 2013 Expanding previous reply a bit, once you've selected a page in this page field, "maths" as an example, you can of course do something like this in front-end of your site: <?php // if your page field is limited to one page and returns a Page object: echo $page->your_page_field->category; // if there are / can be multiple selected pages in this field and a PageArray object is returned: foreach ($page->your_page_field as $item) { echo $item->category . "<br />"; } 1 Link to comment Share on other sites More sharing options...
Manol Posted May 9, 2013 Author Share Posted May 9, 2013 Thank you, I wanted to be able to generate pages from admin as well as importing them from a CSV file which has only the number for each subject ( ex. maths=10). Link to comment Share on other sites More sharing options...
Soma Posted May 10, 2013 Share Posted May 10, 2013 What is this number for the category you'r importing? In PW a category would be best handled as a page, so it could be the ID of that page. Then you make references using the page field. Common scenario is to import/create categories first then use their id's to import data. Link to comment Share on other sites More sharing options...
Manol Posted May 11, 2013 Author Share Posted May 11, 2013 Hello Soma that sounds like a good solution, thank you. 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