07-01-2007, 11:36 AM
[eluser]Michael Ekoka[/eluser]
Since the aim of Scaffolding is to quickly access tables in the db, I find it simpler to have one controller solely used for that purpose.
I use something like this:
Then to scaffold a table, in my url I can simply enter the name of the table and authorize the switch:
http://localhost/myapp/scaffold_controller/scaffold_trigger/my_db_table/switch
in reality it would look more like this :
http://localhost/blog/scaffold/go/entries/switch
As have been said by wiser men than me, use scaffold with lots of caution and in dev only.
Since the aim of Scaffolding is to quickly access tables in the db, I find it simpler to have one controller solely used for that purpose.
I use something like this:
Code:
class Scaffold_controller extends Controller{
public function __construct(){
session_start();
parent::Controller();
if($this->uri->segment(4)=='switch'){
$_SESSION[APPPATH]['table_to_scaffold']= $this->uri->segment(3);
}
$this->load->scaffolding(@$_SESSION[APPPATH]['table_to_scaffold']);
}
}
Then to scaffold a table, in my url I can simply enter the name of the table and authorize the switch:
http://localhost/myapp/scaffold_controller/scaffold_trigger/my_db_table/switch
in reality it would look more like this :
http://localhost/blog/scaffold/go/entries/switch
As have been said by wiser men than me, use scaffold with lots of caution and in dev only.