コード例 #1
0
 /**
  * Saved edited page; called via ajax
  * @return string
  */
 public function postSavePage()
 {
     $okay = true;
     $page_id = $this->request->input('page_id');
     $page_content = $this->request->input('thedata');
     if ($page_id > 0) {
         $page = Page::find($page_id);
     } else {
         $page = new Page();
         $slugify = new Slugify();
         $browser_title = $this->request->input('broswer_title');
         $page->browser_title = $browser_title;
         $page->slug = $slugify->slugify($browser_title);
         $results = Page::where('slug', '=', $slugify->slugify($browser_title))->first();
         if ($results) {
             $okay = false;
         }
     }
     $page->page_content = $page_content;
     if ($okay) {
         $page->save();
         echo "OK";
     } else {
         echo "Browser title is already in use!";
     }
 }
コード例 #2
0
ファイル: AdminController.php プロジェクト: pagchen/acme
 /**
  * Saved edited page; called via ajax
  * @return string
  */
 public function postSavePage()
 {
     $okay = true;
     $page_id = $_REQUEST['page_id'];
     $page_content = $_REQUEST['thedata'];
     if ($page_id > 0) {
         $page = Page::find($page_id);
     } else {
         $page = new Page();
         $slugify = new Slugify();
         $browser_title = $_REQUEST['browser_title'];
         $page->browser_title = $browser_title;
         $page->slug = $slugify->slugify($browser_title);
         // verify that the slug is not already in the db
         $results = Page::where('slug', '=', $slugify->slugify($browser_title))->get();
         foreach ($results as $result) {
             $okay = false;
         }
     }
     $page->page_content = $page_content;
     if ($okay) {
         $page->save();
         echo "OK";
     } else {
         echo "Browser Title already in use";
     }
 }
コード例 #3
0
ファイル: PageController.php プロジェクト: sahid48/acme
 public function getShowPage()
 {
     $browser_title = "";
     $page_content = "";
     $page_id = 0;
     //echo "About";
     //extract page name form urldecode
     $uri = explode('/', $_SERVER['REQUEST_URI']);
     $target = $uri[1];
     //find matching in database
     $page = Page::where('slug', '=', $target)->get();
     //dd($page);
     //look up page content
     foreach ($page as $item) {
         $browser_title = $item->browser_title;
         $page_content = $item->page_content;
         $page_id = $item->id;
     }
     if (strlen($browser_title) == 0) {
         //echo "hej";
         header("HTTP/1.0 Not Found");
         header("Location: /page-not-found");
         exit;
     }
     //pass content to some blade template
     //render template
     echo $this->blade->render('generic-page', ['browser_title' => $browser_title, 'page_content' => $page_content, 'page_id' => $page_id]);
 }
コード例 #4
0
 /**
  * Show a generic page from db
  * @return html
  */
 public function getShowPage()
 {
     // extract page name from the url
     $target = $this->getUri();
     // find matching page in the db
     $this->page = Page::where('slug', '=', $target)->first();
     // look up page content
     if ($this->page) {
         $browser_title = $this->page->browser_title;
         $page_content = $this->page->page_content;
         $page_id = $this->page->id;
     }
     if (!isset($browser_title)) {
         $this->getShow404();
         return true;
     }
     return $this->response->with('browser_title', $browser_title)->with('page_content', $page_content)->with('page_id', $page_id)->withView('generic-page')->render();
 }
コード例 #5
0
ファイル: PageController.php プロジェクト: pagchen/acme
 public function getShowPage()
 {
     $browser_title = '';
     $page_content = '';
     $page_id = 0;
     $uri = explode('/', $_SERVER['REQUEST_URI']);
     $target = $uri[1];
     $page = Page::where('slug', '=', $target)->get();
     foreach ($page as $item) {
         $browser_title = $item->browser_title;
         $page_content = $item->page_content;
         $page_id = $item->id;
     }
     if (strlen($browser_title) == 0) {
         header("Location: /page-not-found");
         exit;
     }
     echo $this->blade->render('generic-page', ['browser_title' => $browser_title, 'page_content' => $page_content, 'page_id' => $page_id]);
 }
コード例 #6
0
 /**
  * Show a generic page from db
  * @return html
  */
 public function getShowPage()
 {
     // extract page name from the url
     $uri = explode("/", $this->request->server['REQUEST_URI']);
     $target = $uri[1];
     // find matching page in the db
     $page = Page::where('slug', '=', $target)->first();
     // look up page content
     if ($page) {
         $browser_title = $page->browser_title;
         $page_content = $page->page_content;
         $page_id = $page->id;
     }
     if (!isset($browser_title)) {
         $this->getShow404();
         exit;
     }
     return $this->response->with('browser_title', $browser_title)->with('page_content', $page_content)->with('page_id', $page_id)->withView('generic-page')->render();
 }
コード例 #7
0
ファイル: PageController.php プロジェクト: sonix022/acme
 public function getShowPage()
 {
     $browser_title = "";
     $page_content = "";
     $page_id = 0;
     //extract page name from the url
     $uri = explode("/", $_SERVER['REQUEST_URI']);
     $target = $uri[1];
     // find matching page in db
     $page = Page::where('slug', '=', $target)->get();
     //lookup the page content
     foreach ($page as $item) {
         $browser_title = $item->browser_title;
         $page_content = $item->page_content;
         $page_id = $item->id;
     }
     if (strlen($browser_title) == 0) {
         header("Location: /page-not-found");
         exit;
     }
     //pass it to blade template
     echo $this->blade->render('generic-page', ['browser_title' => $browser_title, 'page_content' => $page_content, 'page_id' => $page_id]);
 }