Guest User

Untitled

a guest
Jul 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. Warning: include(/var/www/web/frameworks/lithium/app/resources/tmp/cache/templates/template_views_layouts_default.html_886_1308416958_798.php) [function.include]: failed to open stream: No such file or directory in /var/www/web/frameworks/lithium/libraries/lithium/template/view/adapter/File.php on line 111
  2.  
  3. Warning: include() [function.include]: Failed opening '/var/www/web/frameworks/lithium/app/resources/tmp/cache/templates/template_views_layouts_default.html_886_1308416958_798.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/web/frameworks/lithium/libraries/lithium/template/view/adapter/File.php on line 111
  4.  
  5. <?php
  6. namespace appmodels;
  7.  
  8. class Posts extends lithiumdataModel {
  9.  
  10. }
  11. ?>
  12.  
  13. <?php
  14.  
  15. namespace appcontrollers;
  16.  
  17. use appmodelsPosts;
  18.  
  19. class PostsController extends lithiumactionController {
  20.  
  21.  
  22. public function index() {
  23. $posts = Posts::all();
  24. return compact('posts');
  25. var_dump($posts);
  26. }
  27.  
  28. public function add() {
  29. if($this->request->data) {
  30. $post = Posts::create($this->request->data);
  31. $success = $post->save();
  32. }
  33. return compact('success');
  34. }
  35. }
  36. ?>
  37.  
  38. <?php foreach($posts as $post): ?>
  39. <article>
  40. <h1><?=$post->title ?></h1>
  41. <p><?=$post->body ?></p>
  42. </article>
  43. <?php endforeach; ?>
  44.  
  45. <?=$this->form->create(); ?>
  46. <?=$this->form->field('title');?>
  47. <?=$this->form->field('body', array('type' => 'textarea'));?>
  48. <?=$this->form->submit('Add Post'); ?>
  49. <?=$this->form->end(); ?>
  50.  
  51. <?php if ($success): ?>
  52. <p>Post Successfully Saved</p>
  53. <?php endif; ?>
  54.  
  55. <?php
  56. namespace appmodels;
  57.  
  58. class Posts extends lithiumdataModel {
  59. public $_meta = array('key' => 'postid');
  60. }
  61.  
  62. ?>
  63.  
  64. public function locations($companyid,$state=null) {
  65.  
  66. /* removes null or false values with array_filter() */
  67. $conditions = array_filter(array('companyid' => $companyid, 'state' => $state));
  68.  
  69. /* pass $conditions array to the Locations model, find all, order by city */
  70. $locations = Locations::find('all', array(
  71. 'conditions' => $conditions,
  72. 'order' => array('city' => 'ASC')
  73. ));
  74.  
  75. return compact('locations');
  76.  
  77. }
Add Comment
Please, Sign In to add comment