Jump to content

Can't Get Widget To Display When Staff Views Client's Profile


Recommended Posts

Posted

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.

Posted

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.
    #
}
Posted

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?

Posted

There are minute differences, mostly internal, the biggest being that the WidgetClient doesn't support tabs. Aside from that they're pretty much identical.

Posted
  On 1/23/2014 at 4:49 PM, Cody said:

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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...