Ahhh, It seems I did a copy & paste from the wrong place :)
Thanks a lot! It works great now.
On Fri, Oct 10, 2008 at 12:17 PM, Larry E. Masters aka PhpNut <
[EMAIL PROTECTED]> wrote:
> class EventsController extends Controller {
> should be:
>
> class EventsController extends AppController {
>
>
> --
> /**
> * @author Larry E. Masters
> * @var string $userName
> * @param string $realName
> * @returns string aka PhpNut
> * @access public
> */
>
> On Fri, Oct 10, 2008 at 10:09 AM, Fabricio Leonardo Sodano Pascazi <
> [EMAIL PROTECTED]> wrote:
>
>> Thanks for the reply, here's my events controller
>>
>> <?php
>>
>> class EventsController extends Controller {
>>
>> var $name = "Events";
>> var $components = array('Upload','ImageRetriever');
>>
>> function admin_index(){
>>
>> $data = $this->Event->findAll();
>> $this->set('data',$data);
>> }
>>
>> function admin_list(){
>> $data = $this->Event->find('list',
>> array( 'fields' => array('name'), 'order' => 'name ASC',
>> 'recursive'=>'0' )
>> );
>>
>> //print_r($x);
>> return $data;
>> }
>>
>> function admin_view( $id ){
>> $this->Event->id = $id;
>> $data = $this->Event->read();
>> $this->set( 'data', $data );
>> }
>>
>> function admin_search( $name = null ){
>>
>> if( !$name ){
>> $name = $this->data['Event']['name'];
>> }
>>
>> $data = $this->Event->findAll("Event.name LIKE '%$name%'
>> COLLATE latin1_swedish_ci ");
>>
>> $this->set( 'data', $data );
>> $this->set( 'name', $name );
>> }
>>
>> function admin_add(){
>> if( $this->data ){
>> if( $this->Event->save( $this->data ) ){
>>
>> $destination = realpath('../webroot/img/uploads/') .
>> '/';
>> $file = $this->data['Event']['image'];
>> unset($this->data['Event']['image']);
>>
>> if( !$file['error'] ){
>> $result = $this->Upload->upload(
>> $file,
>> $destination,
>> 'event_' . $this->Event->id .
>> $this->ImageRetriever->getImageType($file)
>> );
>>
>> if($this->Upload->errors){
>>
>> $this->Session->setError($this->Upload->errors);
>> $this->redirect('/admin/events/edit/' . $id);
>> exit();
>> }
>> }
>>
>> $this->redirect('/admin/events/');
>> }
>>
>> }else{
>>
>> $this->set('places',$this->requestAction('/admin/places/list'));
>> }
>> }
>>
>> function admin_edit( $id ){
>> $this->Event->id = $id;
>>
>> if( $this->data ){
>> $destination = realpath('../webroot/img/uploads/') . '/';
>> $file = $this->data['Event']['image'];
>> unset($this->data['Event']['image']);
>>
>> if( !$file['error'] ){
>> $result = $this->Upload->upload(
>> $file,
>> $destination,
>> 'event_' . $this->Event->id .
>> $this->ImageRetriever->getImageType($file)
>> );
>>
>> if($this->Upload->errors){
>> $this->Session->setError($this->Upload->errors);
>> $this->redirect('/admin/events/edit/' . $id);
>> exit();
>> }
>> }
>>
>> if( $this->Event->save( $this->data ) ){
>> $this->redirect('/admin/events/view/' . $id);
>> }
>> }else{
>> $this->data = $this->Event->read();
>>
>> $this->set('places',$this->requestAction('/admin/places/list'));
>> }
>> }
>>
>> function admin_delete( $id ){
>> $this->Event->del($id);
>> $this->redirect('/admin/events');
>> }
>>
>> }
>>
>> ?>
>>
>>
>> On Thu, Oct 9, 2008 at 9:37 PM, David C. Zentgraf <[EMAIL PROTECTED]>wrote:
>>
>>>
>>> Paste your EventsController too...
>>>
>>>
>>> On 10 Oct 2008, at 00:06, Fibra wrote:
>>>
>>> >
>>> > Hello Everyone, how are you?
>>> >
>>> > I've read this issue in other posts but most of the solutions are
>>> > becouse they've updated to a newer version.
>>> >
>>> > Since I just downloaded the latest stable version on cake,
>>> > cake_1.2.0.7692-rc3.tar.bz2 I must ask for help.
>>> >
>>> > Here's the thing:
>>> >
>>> > I have my routing.admin turned on, and placed my app_controller.php
>>> > under /app
>>> >
>>> > here's the code:
>>> >
>>> > <?php
>>> > class AppController extends Controller {
>>> > function __construct(){
>>> > die('wtf');
>>> > }
>>> >
>>> > function beforeFilter(){
>>> > echo 'ok';
>>> > if (isset($this->params['admin'])) {
>>> > $this->layout = 'admin';
>>> > }
>>> > }
>>> >
>>> > }
>>> > ?>
>>> >
>>> > Neither 'ok' or 'wtf' get printed once I access /admin/events, however
>>> > they DO get printed when I access /admin, but that's becouse I forced
>>> > to have the admin_layout like this:
>>> >
>>> > Router::connect('/admin', array('controller' => 'pages','layout' =>
>>> > 'admin', 'action' => 'display', 'admin_home'));
>>> >
>>> > So, any ideas? Do I have to post more info for this issue?
>>> >
>>> > Thanks in advance!
>>> >
>>> > >
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---