Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This can be done with CakePHP. However, you have your concerns mixed up. The Model is there for data gathering, manipulation and massaging. The layout of the data is under the responsibilities of the View. In CakePHP specifically the Form Helper.</p> <p>For more info about how to specify your own layout for a data validation message check out:</p> <p><a href="http://book.cakephp.org/view/1639/options-inputDefaults" rel="nofollow">http://book.cakephp.org/view/1639/options-inputDefaults</a></p> <p>They provide a pretty great code sample on exactly how to do this.</p> <p>I also <strong>highly</strong> suggest you read through the whole book. It will prove invaluable.</p> <p>Edit: Answer after clarification from comment</p> <p>You would create an <code>element</code> and put it in <code>app/views/elements</code>. Should name the file using normal Cake conventions. Let's go with <code>flash_error</code>.</p> <p>You would set this up to be your HTML that you want displayed. To make sure your message is displayed simply add this bit of PHP wherever is appropriate</p> <p><code>&lt;?php echo $message; ?&gt;</code></p> <p>That's step 1.</p> <p>Step 2 is in your <code>$this-&gt;setFlash()</code> call pass the appropriate parameters. So your new calls would look like this with the element we named above:</p> <p><code>$this-&gt;setFlash($message, 'flash_error');</code></p> <p>Now your setFlash messages will use the layout defined in step 1. Wanna different layout? Just create a new element and pass the new element name. </p> <p>The setFlash() method has 2 more parameters that come in handy (particularly if you want to have multiple flash() messages on the same page). Another link to the book:</p> <p><a href="http://book.cakephp.org/view/1313/setFlash" rel="nofollow">http://book.cakephp.org/view/1313/setFlash</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload