I composed a simple small tool, letting me practice by myself and the
usage of the test model with examine back to spread.

controller:
<?php
class DemoController extends AppController
{
        //var $scaffold;
        var $name = 'Demo';
        var $uses = array();
        var $helpers = array('Html', 'Form' );

        function index(){
            if(!empty($this->data)){
                $command_str = '$model = new
'.$this->data['Test']['model'].";\n";
                $command_str .= '$result =
$model->'.$this->data['Test']['Command'].';';
                eval($command_str);
                $this->set('command_str',$command_str);
                $this->set('result',$result);
            }
        }
}
?>

view:
<form action="<?=$html->url('/demo/')?>" method="post">
    <label>Model Name</label>
    <?=$html->input('Test/model',array('size'=> '40'))?>
    <label>Function</label>
    <?=$html->input('Test/Command',array('size'=> '40'))?>
    <?=$html->submit();?>
</form>

<h1>Code</h1>
<?
if(isset($command_str)){
    highlight_string($command_str);
}
?>


<h1>Result</h1>
<?
if(isset($result)){
    pr($result);
}
?>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to