This is what i'm trying to do class FooController extends AppController{ var $name = "Foo"; var $useTable = false; };
class Foo extends AppModel{ var $name = "Foo"; var $useTable = false; private $text = ""; public function setText($txt){$this->text = $txt;} public function getText(){return $this->text;} }; /** foo.ctp **/ <h1><?php echo $foo->getText(); ?></h1> class otherController extends AppController{ /* ... */ public $uses = array('Foo'); public function myaction(){ $this->Foo->set('my text'); $this->set('foo', 'my text'); } } /** otherController/myaction.ctp **/ <?php echo $foo->render(); ?> Of course it doesn't work, beczuse in otherController, Foo is a Model not a controller so Foo->render() doesn't exist. maybe i have to do something like : public function myaction(){ load FooController $this->FooController->Foo->setText("hello world"); $this->set('foo', $this->FooController); } but how can i load controller from an other controller ? On Jul 3, 2:56 pm, the_woodsman <[EMAIL PROTECTED]> wrote: > There are various approaches. > > One is to create a view called default_index.ctp, which refers to > generic names, i.e $mainModel, or something similar. > > Then in your controllers, make sure you pass the data in a similar > format to the view, with the correct generic names, i.e > > $this->set('mainModel','User'); > > Then, force the controllers to render the default view with $this- > > >render('viewPath'). > > I believe scaffolding works in a vaguely similar way. But as I said, > there are other approaches too... > > On 3 Jul, 09:44, FluF <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I'm working on a project to display many statistics from many > > Models( clients, phonecalls, benefits, ..). > > Those statistics have the same presentation : > > - html table with different CSS but the same HTML code > > - ordonnable columns (not all) > > - tooltips for columns > > ... > > - graphics using GD2 > > > So before i found CakePhp ( and MVC) , i wrote this: > > > class ArrayToTable { > > public function __construct($my2DArray, $params){ > > /*...*/ > > } > > /* other functions */ > > public function process(){ > > /* do some stuff with my2DArray */ > > } > > public function render(){ > > /* return the HTML code */ > > } > > > }; > > > And i used > > $bar = new ArrayToTable($result); > > /* work with $bar */ ; > > echo $bar->render(); > > > I found requestAction, but i don't know if it is the correct way. > > > So how can i do that with cakePHP ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---