17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1925 Views |
-
how can i deal with the $_post parameters before write

23 June 2008 at 3:28pm
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 ??? -
Re: how can i deal with the $_post parameters before write

23 June 2008 at 4:39pm
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 -
Re: how can i deal with the $_post parameters before write

23 June 2008 at 4:42pm
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
-
Re: how can i deal with the $_post parameters before write

23 June 2008 at 4:57pm
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 valuebut on the serverside before save the value to the database , i want to change the testvalue.
do some validation or do some text2html things. -
Re: how can i deal with the $_post parameters before write

23 June 2008 at 6:24pm
can you use onBeforeWrite() on your dataobject
http://doc.silverstripe.com/doku.php?id=datamodel&s=onbeforewrite#onbeforewrite -
Re: how can i deal with the $_post parameters before write

23 June 2008 at 7:31pm
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
| 1925 Views | ||
|
Page:
1
|
Go to Top |



