Friday, June 22, 2012

Redirect after Print Output

Hi together,

i would like to have a "print" view. everthing is fine and my print-view is showing but i would like to redirect after the printjob is done.

here is my code

print.ctp (View->Layouts)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PrintView</title>
</head>
<body onload="window.print();">
<?php echo $content_for_layout; ?>
</body>
</html>


JobsController.php
public function print($id = null) {
        $this->Job->id = $id;
        if (!$this->Job->exists()) {
            throw new NotFoundException(__('Auftrag existiert nicht'));
            $this->redirect(array('action'=>'index'), null, true);
        }
        $this->set('job', $this->Job->read(null, $id));
        $this->layout = 'print';
        $this->render();
    }


When i put following codeline to the controller
$this->redirect(array('action'=>'view', $id), null, true);
The print view is not shown and i get the view page directly.

Is there any possibility to print the "print view" in the background ?
Or any other ideas how i could solve the problem ?

Nice Greetings
Jerome

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate