Jump to content

$Success


EmptyMind

Recommended Posts

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. 
Link to comment
Share on other sites

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);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...