4 January 2009 at 12:29pm
I would like to create a checkbox in my admin area for my client to indicate whether an item in her online gallery has been sold or not. If an item is sold, then I have a little extra HTML to insert in the page ("SOLD. This item has been sold and is available for viewing only.").
I know how to create images and text fields in the CMS, but how to create a checkbox?
And then how do I call an "if" statement on the checkbox in my template page? Would I need to write a function to query the state of the checkbox or can I check its value in the database directly?
4 January 2009 at 3:15pm
(Last edited: 4 January 2009 3:18pm),
Hi Boogiez, welcome to Silverstripe
I would recommend you do the tutorials to start with, they give you a very good introduction to how both the templates and admin/db work. You can find them here: [url]http://doc.silverstripe.com/doku.php[/url]
To answer your question you can easily add a checkbox to a page in the admin by adding this to your Page.php file:
Recipies (various how too's): [url]http://doc.silverstripe.com/doku.php?id=recipes:start[/url]
I think the tutorials are invaluable if you want to start developing sites in SS beacuse they give you a really good introduction to how it all works and so once you have done them you can really start descovering the beauty of SS (with the help of the docs and forum of course)
Anyway good luck and hope to see you around the forums :)