当前位置: 首页>>代码示例>>PHP>>正文


PHP post::set_post_data_by_id方法代码示例

本文整理汇总了PHP中post::set_post_data_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP post::set_post_data_by_id方法的具体用法?PHP post::set_post_data_by_id怎么用?PHP post::set_post_data_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在post的用法示例。


在下文中一共展示了post::set_post_data_by_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_page_by_url

 public function get_page_by_url()
 {
     global $sql, $smarty, $user;
     $url_temp = substr($_SERVER['REQUEST_URI'], 15);
     //ez csak localhost-on kell, mert ott bent van az easyaccessblog könyvtárban minden
     //die($url_temp);
     //die($_SERVER['REQUEST_URI']);
     if (substr_count($url_temp, '/') == 2) {
         $endpos = strpos($url_temp, '/', 1);
         $this->dir = substr($url_temp, 1, $endpos - 1);
         if ($this->dir == 'admin') {
             $this->admin = true;
         }
     } else {
         $this->dir = null;
     }
     if (strstr($url_temp, "?p=")) {
         $this->action = substr($url_temp, strpos($url_temp, "?p=") + 3);
         //ellenőrizzük van-e egyéb paraméter, mert akkor azt levágjuk
         if (strstr($this->action, '&')) {
             $endpos = strpos($this->action, '&', 1);
             $this->action = substr($this->action, 0, $endpos);
         }
     } else {
         //load simple index.php site
         if (!$this->is_admin()) {
             $this->action = 'default';
         } else {
             $this->action = 'default_admin';
         }
     }
     $this->file = $this->action;
     // login.php
     /*
     if (substr_count($_SERVER['REQUEST_URI'],'/')==2) {
     	$endpos = strpos($_SERVER['REQUEST_URI'], '/', 1);
     	$dir = substr($_SERVER['REQUEST_URI'], 1, $endpos-1);
     }
     */
     //$assoc_array = $sql->get_page($this->file, $this->dir);
     //die($this->dir . "h");
     if ($this->dir) {
         $this->p_user = new user();
         $this->p_user->set_user_data_by_name($this->dir);
     }
     $this->url = $this->action . '.tpl';
     //itt most lekérünk egyéb smarty adatokat -------------------------------------------------
     //default.tpl adatai (főoldali bejegyzések)
     //le kell kérni a userhez tartozó össszes (type=1) postot, dátum szerint csökkenő sorrendben
     //és ezeket átadni tömbben (a tömbben post objektumok legyenek)
     if ($this->action == 'default' && !$this->is_admin() && $this->p_user != null) {
         $post_list = $sql->assoc_array('select * from post where post_type = 1 and post_status = 2 and post_author = ' . $this->p_user->get_user_id() . (isset($_GET['tag']) ? ' and post_id in (select tp_post_id from tag_post where tp_tag_id = ' . $_GET['tag'] . ')' : '') . (isset($_GET['category']) ? ' and post_cat_id  = ' . $_GET['category'] : '') . ' order by post_date desc;');
         $post_array = array();
         foreach ($post_list as $key => $post_obj) {
             $new_post = new post();
             $new_post->set_post_data_by_id($post_obj['post_id']);
             $new_post->decode_content();
             $post_array[] = $new_post;
             //var_dump($post_obj);
         }
         $smarty->assign('post_list', $post_array);
     }
     //defaul.tpl vége
     //default.tpl admin esetén
     if ($this->action == 'default' && $this->is_admin()) {
         //do smthng
     }
     //default vége admin esetén
     //önálló bejegyzés megtekintése
     if ($this->action == 'view_post') {
         //ez azért kell mert ebben benne van a user ellenőrzés is; ha nem lenne, akkor bármelyik felhasználó blogjából meghívhatnánk bármelyik bejegyzést
         $post_id = $sql->single_variable("select post_id from post where post_id = " . $_GET['id'] . " and post_author = " . $this->p_user->get_user_id() . ";");
         $new_post = new post();
         $new_post->set_post_data_by_id($post_id);
         $new_post->decode_content();
         $smarty->assign('post', $new_post);
         //lekérjük a  bejegyzéshez tartozó kommenteket
         $comments = $sql->assoc_array('select com_id from comment where com_post = ' . $_GET['id'] . ' order by com_date desc;');
         $comment_array = array();
         foreach ($comments as $key => $com_obj) {
             $comment = new comment();
             $comment->set_com_data_by_id($com_obj['com_id']);
             $comment_array[] = $comment;
         }
         $smarty->assign('comment_list', $comment_array);
     }
     //bejegyzés megtekintésének vége
     //új bejegyzés létrehozása
     if ($this->action == 'edit_post') {
         //kategóriák lekérése
         $category_list = $sql->assoc_array('select * from category where cat_author = ' . $user->get_user_id());
         $category_array = array();
         foreach ($category_list as $key => $val) {
             $category = new category();
             foreach ($val as $key_inner => $value_inner) {
                 if ($key_inner == "cat_id") {
                     $category->set_cat_id($value_inner);
                 } elseif ($key_inner == "cat_name") {
                     $category->set_cat_name($value_inner);
                 } elseif ($key_inner == "cat_author") {
//.........这里部分代码省略.........
开发者ID:tricsusz,项目名称:Easy-Acces-Blog,代码行数:101,代码来源:class_lib.php


注:本文中的post::set_post_data_by_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。