Welcome Guest, Not a member yet? Register   Sign In
simultaneous scaffolding?
#1

[eluser]foobarph[/eluser]
hello everyone!

i've been using code igniter for a week now and i must say it's a good php framework, unlike cake php, syfony, zend, etc.. this is one of the best.

*eherm, enuf w/ the intro*

we all know that we can use scaffolding..
we also know that we can only use one table when using scaffolding..

my question is, is it possible for me to "define" a specific table which my scaffolding feature will use? and not the only table that i defined on the routes.php file?

it's a pain to create a customized edit/delete page for my database wherein scaffolding is the best solution for that.

any kind of help will be appreciated. thanks! thanks! thanks!
#2

[eluser]Taff[/eluser]
Hey there,
welcome to the forums.
Maybe I misunterstood your question but in the routes you only assign a magic word

Code:
$route['scaffolding_trigger'] = "scaffolding";

Then in your controller you can tell it what table you want to manage:

Code:
<?php
class Blog extends Controller {

       function Blog()
       {
            parent::Controller();

            $this->load->scaffolding('table_comments');
       }
}
?>

will then allow you to edit your table named "table_comments" by going to

Code:
Path/to/site/blog/scaffolding

where scaffolding is the magic word we defined in the routes.php file.
I'm a beginner myself, but hope I understood your question correctly and this helps

More info about scaffolding can be found at http://ellislab.com/codeigniter/user-gui...lding.html

Good luck,
Taff
#3

[eluser]foobarph[/eluser]
thanks taff!

btw, is this correct?

Code:
<?php
class Blog extends Controller {

       function Blog()
       {
            parent::Controller();

            $this->load->scaffolding('table_one');
       }

       function anothermod()
       {
            $this->load->scaffolding('table_two');
       }

}
?>

or this will not work?
#4

[eluser]xwero[/eluser]
You can't call the constructor, Blog in your case, so in order to display the first table you have to add an index method. I think it's also better to put the scaffolding call in the index method.

But there are solutions on the forum to scaffold all tables using 'hacks' if you want to show more than one table without the need to create methods only for the scaffolding.




Theme © iAndrew 2016 - Forum software by © MyBB