Guest User

Untitled

a guest
Apr 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. reikia susikurt nauja layouta ajax.ctp ir jame idet tiktai <?php echo $content_for_layout; ?>
  2.  
  3. i var $components = array('RequestHandler');
  4.  
  5. function getComment($id)
  6. {
  7.  
  8. $id = (int)$id;
  9. if ($id > 0)
  10. {
  11. $data = $this->Comment->read(null, $id);
  12. if (!empty($data))
  13. {
  14. $this->set('comment', $data);
  15. }
  16. else
  17. {
  18. $this->Session->setFlash('There is no such comment (maybe it was deleted)');
  19. $this->redirect('/');
  20. exit;
  21. }
  22. }
  23. // cia yra visa esme kuri detektina, kad uzklausa pateikta ajax'u
  24. if ($this->RequestHandler->isAjax())
  25. {
  26. $this->layout = 'ajax';
  27. }
  28.  
  29. }
Add Comment
Please, Sign In to add comment