문제

I have been wondering if there is a standard way of doing session based messages in Silverstripe.

For example a module could set a message like The task has been processed and then redirect to another page, and the message would be displayed in a small box on that page.

For example Django framework has http://docs.djangoproject.com/en/dev/ref/contrib/messages/ Drupal has http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/drupal_set_message

I have googled this and found no modules or built in functionality to dot this. It would be good if all apps, even external ones would handle messaging in the same way. Is this just something that is missing in Silverstripe?

도움이 되었습니까?

해결책

You could do this using Session::addToArray($key, $value) (http://api.silverstripe.org/2.4/sapphire/control/Session.html#methodaddToArray). Then Session::get($key) to retrieve the value.

다른 팁

I've made a patch to implement this feature, as it really should be in core.

See http://open.silverstripe.org/ticket/6633

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top