Welcome Guest, Not a member yet? Register   Sign In
set_message Dysplay
#2

[eluser]vrencianz[/eluser]
The set_message() function is used to display error messages (See http://ellislab.com/codeigniter/user-gui...tingerrors for setails).

To display a success message

1) You can use the success page

or:

2) Create two helper functions (in a file helpers/utils_helper.php, for example)

Code:
/**
* Sets a feedback message as flashdata
* @param string $feedback
*/
function set_feedback($feedback)
{
$CI =& get_instance();

$CI->session->set_flashdata('feedback', $feedback);
}

/**
* Gets the feedback data set by set_feedback($feedback)
* @return the feedback message or FALSE if it is not set
*/
function feedback()
{
$CI =& get_instance();

return $CI->session->flashdata('feedback');
}

3) On success call <b>set_feedback('Login success');</b>

4) Somewhere in your view insert

Code:
&lt;?php if($feedback): ?&gt;
<div id="feedback">
  &lt;?=$feedback?&gt;
</div>
&lt;?php endif?&gt;

5) load your view

Code:
$this->load->helper('utils');
...
$data['feedback'] = feedback();

$this->load->view('your_view', $data);

I hope this helps.


Messages In This Thread
set_message Dysplay - by El Forum - 05-12-2012, 02:46 AM
set_message Dysplay - by El Forum - 05-12-2012, 04:34 AM
set_message Dysplay - by El Forum - 05-12-2012, 05:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB