closer12 Posted June 10, 2014 Posted June 10, 2014 Hi. I am new on processwire. I want to add checkbox fields to my page edit and when if they are selected. I want to show the text in the front page. I couldnt find where i can enter the value of checkbox and how to show in theme ? Can you give me a small example ? I took the snap from this video ( http://processwire.com/videos/field-dependencies/ ) i want to do smilar. thank you
Martijn Geerts Posted June 10, 2014 Posted June 10, 2014 Checkboxes like that a Page reference fields. Checkout this: 1
closer12 Posted June 10, 2014 Author Posted June 10, 2014 I watched but still cant find where i can add the value and how to show in template ...
Martijn Geerts Posted June 10, 2014 Posted June 10, 2014 It's in the page tree. Selects and Checkboxes are infact pages (Fieldtype Page). For the page references, select the options page as parent. Look at the page tree below. options ( options template ) | +-- option one ( option template ) | +-- option two ( option template ) | +-- option three ( option template ) 2
adrian Posted June 10, 2014 Posted June 10, 2014 It actually depends a bit whether you want a single checkbox, or an array of checkbox items to choose from. The former is simply a matter a creating a field of type checkbox. The latter is what Martijn is talking about and requires creating a pagefield. 2
Ole Posted June 11, 2014 Posted June 11, 2014 Do you want to control the display of your pages with a checkbox? That means, if you assign the checkbox in a page, this page will be shown in the frontend?Or do you want control specific elements (like body, title...) of your page?
closer12 Posted June 11, 2014 Author Posted June 11, 2014 my question is very simple. I want to make a one checkbox and if this checkbox is checked i want to show some text in the page ... But i couldnt find where i can enter that text when i create a checkbox in the fields. and how to show in the template. i need very simple example for understanding. My checkbox name is : check İ added this to template : <?php echo $page->check; ?> and when i checked its show : 1 but how i can show a text ?
SiNNuT Posted June 11, 2014 Posted June 11, 2014 <?php if ($page->check == 1) // 1 is checked, 0 is unchecked echo "some text"; echo $page->sometextfield; ?> 6 1
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