Quote
6 replies to this topic
#1
Posted 17 February 2012 - 04:17 PM
It would be great if there would be an easy way to add flash-type of session variables. Here is citation from codeigniter docs:
CodeIgniter supports "flashdata", or session data that will only be available for the next server request, and are then automatically cleared. These can be very useful, and are typically used for informational or status messages (for example: "record 2 deleted").
Follow me at Twitter - Mostly about ProcessWire AdminBar - Simple front end editing for PW ProcessRedirects - Manage redirects in PW-admin
#2
Posted 17 February 2012 - 04:58 PM
Ahh... now I get it. There is $notices variable. Very nice.
If others are thinking how to use it, just take a look at notices.inc from templates-admin folder. You can access the very same $notices from your template code. And setting these notices is super simple:
If others are thinking how to use it, just take a look at notices.inc from templates-admin folder. You can access the very same $notices from your template code. And setting these notices is super simple:
$session->error("Houston, we have a problem");
$session->message("Hello world!");
Follow me at Twitter - Mostly about ProcessWire AdminBar - Simple front end editing for PW ProcessRedirects - Manage redirects in PW-admin
#3
Posted 18 February 2012 - 09:11 AM
So it's solved?
If your problem isn't solved by using search function (wink, wink), please don't hesitate to ask.
I like content PW user more than confused not-PW users :)
I like content PW user more than confused not-PW users :)
#4
Posted 18 February 2012 - 09:14 AM
Yep. Although mention about these on session docs and on cheatsheet would be nice.
Follow me at Twitter - Mostly about ProcessWire AdminBar - Simple front end editing for PW ProcessRedirects - Manage redirects in PW-admin
#5
Posted 18 February 2012 - 10:36 AM
I don't really get it. Notice class has something to do with flash session data?
@somartist - wire("soma")->is("creative|coder")->say("hello");
#6
Posted 18 February 2012 - 12:01 PM
You do this on template:
$session->error("error error");
or this on class:
$this->session->error("error error");
End then on next page load you can have this:
And that error notice is gone, no need to clear it yourself.
$session->error("error error");
or this on class:
$this->session->error("error error");
End then on next page load you can have this:
foreach($notices as $notice) {
if($notice instanceof NoticeError) {
echo "<p>$notice->text</p>";
}
}
And that error notice is gone, no need to clear it yourself.
Follow me at Twitter - Mostly about ProcessWire AdminBar - Simple front end editing for PW ProcessRedirects - Manage redirects in PW-admin
#7
Posted 20 February 2012 - 01:39 PM
I never knew the name for it. It's good to hear that, "flashdata".
This was mainly setup so that modules could queue messages that would only be seen on a follow-up page. Since many modules do a session->redirect() after a save, there needed to be a way to queue those messages to be seen on the following page load rather than the current (where they would never be seen). I don't think that you actually have to call $session->message(), as I think any notice sent through message() or error() gets queued. Though calling $session->message() is a good way to make that intention clear from the code side.
Also tagged with solved, session
ProcessWire Support →
General Support →
Cannot Upload Images (403 Forbidden)Started by newtopw, 13 May 2012 |
|
|
||
solved
ProcessWire Support →
General Support →
Installation problem... Only homepage and then 404 error...Started by celfred, 11 May 2012 |
|
|
||
solved
ProcessWire Support →
General Support →
Module auto add scripts stylesStarted by Soma, 08 May 2012 |
|
|
||
solved
ProcessWire Support →
General Support →
jQuery Wire Tabs PluginStarted by norboo, 08 May 2012 |
|
|
||
solved
ProcessWire Support →
Getting Started →
new page nav in adminStarted by robrainfall, 07 May 2012 |
|
|
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











