EmptyMind Posted July 4, 2013 Report Share Posted July 4, 2013 Quick one off question. How would one set the '$success' array that is referenced in message.pdt to provide the green 'info box'? Input->setErrors() is used to set the $errors array for the red box. Quote Link to comment Share on other sites More sharing options...
Gualter Posted July 4, 2013 Report Share Posted July 4, 2013 Basic code ^^ but I think wrong lol {if $success} <div class=green>{$success}</div> {else} <div class=red>{Input->setErrors();}</div> {/if} Quote Link to comment Share on other sites More sharing options...
EmptyMind Posted July 4, 2013 Author Report Share Posted July 4, 2013 The view code is already there.. (cut from app/views/admin/default/message.pdt) --- <section class="error_section"> <?php // $success is an alias for $message if (isset($success)) $message = $success; if (isset($message)) { ?> <article class="error_box"> --- I just want to be able to set '$success' for the view to display from my module widget. Adding this code: $this->Input->setErrors(array('test' => array('info' => "An unknown error has occured" ))); In my module widget code, causes the red error box to pop up with the error message. I'm looking for the bit that would allow me to set a 'Success' message which appears in Green with a checkmark. (as per the code above) and can be seen for example by adding a service to a user or Successfully updating the service entries or the like. Quote Link to comment Share on other sites More sharing options...
Tyson Posted July 5, 2013 Report Share Posted July 5, 2013 If I recall correctly, the module does not have access to do this through AppController::setMessage(), which would be: $this->setMessage("message", "Success!"); So you would need to fetch the message template yourself and set it in your widget template: // Untested code to fetch the message template, set your success message, and set it as the variable $message in your template $this->set("message", $this->partial("message", array('message' => "Success!"))); Then call it from your widget template: echo $this->Html->ifSet($message); 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.