Hi AD!

Thanks for your reply!

Ok, I'm beginning to see it:

I've created a new component: test.php in controllers/components

class TestComponent extends TemplateComponent {
    var $name= 'Test';

    function _getData() {
        // some data for testing purposes
        $data = 'hello world';
        return $data;
    }
}

In my posts_controller I added:

var $components = array ('Test');

And in views/posts/index.thtml:

<? php print_r($MenuContext); ?>

But I keep getting the error:

Call to a member function on a non-object in /var/www/vhosts/zomp.nl/
httpdocs/framework/app/controllers/components/template.php on line 213

Maybe I'm still doing something silly, but I don't see it now.

I've succeeded in creating a widget menu-structure using requestAction
and the plugins-system, but since many requestAction calls can easily
increase page loading times, I think your solution would be much more
elegant.

Thanks!

Gerben.


On 12 mrt, 08:59, "AD7six" <[EMAIL PROTECTED]> wrote:
> On Mar 11, 3:59 pm, "gerbenzomp" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hey AD7six,
>
> > I've been working hard to try and get your example code to work
> > (http://www.noswad.me.uk/MiBlog/MiniControllers), but being fairly new
> > to cake, I guess I got stuck because I've jumped from the basics to
> > something more advanced. I thought if I would get your archive example
> > to work, I would understand the concept, and could go on creating my
> > own "widgets" (or "blobs", as you called them). But I gues I need some
> > more guidance as to the structure of the plugins your example code
> > expects.
>
> > To my understanding I need to create a plugin called "blogs" (with its
> > own blogs_app_controller.php and blogs_app_model.php and its own
> > controller, model and views), but I guess I am wrong.  I wasn't sure
> > either how I should include the widget in another controller's view.
>
> > Can you explain a bit more about how to implement your solution?
>
> Hi Gerbenzomp,
>
> You shouldn't need a plugin to make use ot that code; the only
> reference to a plugin is to generate the cache path.
>
> With the code as presented as of right now, if you:
>
> put the template and 'your' component in your app/controllers/
> component folder
> In your controller you have var $components = array('your');
> define the method _getData in 'your' component to return something
> (anything if you are just testing).
>
> Then in your view/layout/element do pr ($MenuContext); die;
>
> That should make thing clearer.
>
> HTH,
>
> AD


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

Reply via email to