Solved

CakePHP setFlash - Can it pass a variable to view?

Posted on 2011-09-25
1
317 Views
Last Modified: 2012-05-12
Beneath is the code I'm using.  I'd like to offer the user the ability to restore the id of whatever it is they just deleted.  In order to do that I need to pass the id back to the view file:
	function admin_delete($id = null) {
		if ( !$id ) {
			$this->Session->setFlash('Invalid event', true);
			$this->redirect(array('action' => 'index'));
		}
		if ($this->Event->softDelete( $id )) {
			$this->Session->setFlash( 'Event deleted', true , array( 'restoreID' => $id ) );
			$this->redirect( array( 'action' => 'index' ) );
		}
	}

Open in new window

0
Comment
Question by:radarhill
1 Comment
 
LVL 1

Accepted Solution

by:
radarhill earned 0 total points
ID: 36596877
Found a way to make this happen myself:
		if ($this->Event->softDelete( $id )) {
			$this->Session->setFlash( 'Event deleted', true );
			$this->redirect( array( 'action' => 'index/restoreID:'.$id ) );
		}

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MYSQL simple update statement 3 33
php documentation 4 21
regex expression 9 23
Programatically extract date from website 8 17
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now