velaware Posted January 22, 2014 Report Share Posted January 22, 2014 This is part of my database manager plugin. I'm trying to create a widget that shows on a client's profile when a staff member goes to view it. Here's the files in question: https://gist.github.com/anzenehansen/eb26e30a8c1f8169bc66 The widget code is a simple boiler template that just has <?php $this->Widget->clear(); $this->Widget->create("Database Manager"); ?> <div class="inner">Tester</div> <?php $this->Widget->end(); ?> Nothing fancy yet so I'm not sure why this isn't displaying. I've also tried: $this->Widget->create(null, "Database Manager"); Still nothing is rendered. The page loads fine otherwise, however. Quote Link to comment Share on other sites More sharing options...
Tyson Posted January 22, 2014 Report Share Posted January 22, 2014 Just glanced at it and it looks like your AdminMain controller does not call preAction(). i.e. /** * Pre action */ public function preAction() { parent::preAction(); # # TODO: load other stuff, like models, helpers, language, etc. # } Quote Link to comment Share on other sites More sharing options...
velaware Posted January 23, 2014 Author Report Share Posted January 23, 2014 I've tried that and it still doesn't show. No errors as far as I know just when I go to the client's profile nothing is added besides the default. Quote Link to comment Share on other sites More sharing options...
Cody Posted January 23, 2014 Report Share Posted January 23, 2014 You should be using the WidgetClient helpers for the client interface, not the Widget helper. They are very similar though. Quote Link to comment Share on other sites More sharing options...
velaware Posted January 23, 2014 Author Report Share Posted January 23, 2014 Issue is fixed. I needed to call return $this->renderAjaxWidgetIfAsync(false); in the index function. @Cody: I'll try that and see if it gives me more of a result that I want. Does it work the same as Widget helper, or is there differences? Quote Link to comment Share on other sites More sharing options...
Cody Posted January 23, 2014 Report Share Posted January 23, 2014 There are minute differences, mostly internal, the biggest being that the WidgetClient doesn't support tabs. Aside from that they're pretty much identical. Quote Link to comment Share on other sites More sharing options...
velaware Posted January 23, 2014 Author Report Share Posted January 23, 2014 There are minute differences, mostly internal, the biggest being that the WidgetClient doesn't support tabs. Aside from that they're pretty much identical. That works for me, lol. Wondering, how do I display text on a widget? I have this codei n my AdminMain controller's index function: $e = "test"; $d = "bob"; $this->set(compact("e", "d")); return $this->renderAjaxWidgetIfAsync(false); In the view file I have this: <?php echo($e . "=" . $d); ?> The code in the vie wfile makes the widget not render at all. Quote Link to comment Share on other sites More sharing options...
velaware Posted January 23, 2014 Author Report Share Posted January 23, 2014 Fixed it. Error on my part Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.