Jump to content

Filed Type Page


Manol
 Share

Recommended Posts

Hello.

1.- I have created:

  •          field type:  page
  •          input typecheckboxes* 
  •          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

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.

  • Like 1
Link to comment
Share on other sites

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 />";
}
  • Like 1
Link to comment
Share on other sites

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

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

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...