when i create or update a page.
it there any function like onbeforexxxx and how can i get those parameters
directly get from $_POST or $_GET ???
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
when i create or update a page.
it there any function like onbeforexxxx and how can i get those parameters
directly get from $_POST or $_GET ???
I don't know if my method is correct or not, but I add functions for this in the page_controller class for the page I am viewing.
For example, I have a page type called Tour. I have a dropdown box for changing currencies on a page, and this simply refreshes the current page with ?cur=value on the URL. So in my Tour_Controller class, I simple add an init() method at the top (so it is called first when the page loads) and do something like this:
function init() {
$parent::init();
if($_GET['cur']) {
// Do my stuff with $_GET['cur'] here
}
}
Cheers
Aaron
Oops, sorry mate - re-read your post and it seems you're talking about the CMS side of things. I have no idea on this sorry, and my post above won't be much good to you.
Aaron
yes, the cms admin side. still thanks a lot.
my situation is i create a TestPage and add a new column , testvalue for eg.
and add it to the cms admin panel,where i can input the value
but on the serverside before save the value to the database , i want to change the testvalue.
do some validation or do some text2html things.
can you use onBeforeWrite() on your dataobject
http://doc.silverstripe.com/doku.php?id=datamodel&s=onbeforewrite#onbeforewrite
another problem is how can i get the request parameter.
the name of the input is not the column of the db,so there is no getter and setter.
can you tell me when the program do getter and setter for the datamodel, where is the code?
i spent much time still can not found