Example analysis of the article class in the CMS based on PHP, _php tutorial

Source: Internet
Author: User

The example analysis of the article class is shown in the CMS based on PHP,


This article describes the article classes that are shown in the CMS based on PHP. Share to everyone for your reference. The specific analysis is as follows:

<?php/***********************************************//example: Include ("config.inc.php"); Database Connection File $info = new Sys_function; $test = new show_article; $test->set_sql ("Select ' id ', ' title ', ' DateAndTime ', ' Thetype ' from ' Df_company_bringup ' ORDER by ' dateandtime ' DESC '); $test->set_filename ("display"); $test->set_ Morename ("Morearticle"), $test->set_icon ("☆"), $test->set_omitstr ("..."); $test->show_company_bringup (); Article List class****/class show_article{/**** declaration ****/var $  SQL, $query, $arr, $article _list;  var $strlen, $articleline, $dateandtime;  var $len, $line, $icon, $omitstr, $line _height, $more _name;  var $year, $month, $day, $datetype; var $showmore, $showdate, $showomit, $showclueon, $showicon; /**** constructor ****/function show_article () {$this->set_strlen (40);//Set the number of words per line; $this->set_articleline (10);// Set article display line number; $this->set_showmore (false); Whether to show "more article"; $this->set_showdate (true); Whether to display article release date; $this-> Set_showomit (true);  Whether the characters you set are displayed after the specified characters, such as "..."; $this->set_showclueon (TRUE); Whether to display the article hint (the mouse moves to the hint shown above the article title); $this->set_open (true);  Whether to open in a new window; $this->set_showicon (TRUE);  Whether to display the article modification prefix; $this->set_lineheight (1.5);  Paragraph line high value; $this->set_datetype (1); Set date format, 1 for 2004-10-21 2 for October 21, 2004;  }/**** sets the number of words per line ****/function Set_strlen ($strlen) {$this->len = $strlen;  }/**** Set article display the number of rows ****/function Set_articleline ($articleline) {$this->line = $articleline;  }/**** Set Query statement ****/function Set_sql ($sql) {$this->sql = $sql;  }/**** set article title prefix adornment ****/function Set_icon ($icon) {$this->icon = $icon;  }/**** whether to display article title prefix adornment ****/function Set_showicon ($showicon) {$this->showicon = $showicon;  }/**** whether to open a new window ****/function Set_open ($open) {$this->open = $open;  /**** Set article the character ****/function Set_omitstr ($omitstr) {$this->omitstr = $omitstr when the caption length exceeds the limit; }/**** set the file name of the open article ****/function set_filename ($filename) {$this-&GT;filename = $filename;  }/**** more article page name ****/function set_morename ($more _name) {$this->more_name = $more _name;  }/****article class name ****/function Set_typename ($type _name) {$this->type_name = $type _name;  }/**** whether to show more article****/function Set_showmore ($showmore) {$this->showmore = $showmore;  /**** Set the date format (1:2004-10-21 2: October 21, 2004) ****/function Set_datetype ($datetype) {$this->datetype = $datetype; /**** formatted date ****/function FormatDate ($dateandtime, $num) {list ($year, $month, $day) = Split ("[-]", substr ($dateandtime,  0,10)); if ($num = = 1) {return $year. " -". $month."  -". $day; }else{return $year. " Year ". $month." Month ". $day."  Day ";  }}/**** whether to display article release date ****/function Set_showdate ($showdate) {$this->showdate = $showdate;  }/**** paragraph line high value ****/function set_lineheight ($line _height) {$this->line_height = $line _height;  /**** whether the article title length exceeds the limit displayed after the character ****/function Set_showomit ($showomit) {$this->showomit = $showomit; /**** whether to show prompt when mouse moves to article/function Set_showclueon ($showclueon) {$this->showclueon = $showclueon;  /**** gets a row from the result set as an enumeration array ****/function Execute_row ($query) {return $this->arr = mysql_fetch_row ($query); /**** gets a row from the result set as an associative array, or a numeric array, or both ****/function Execute_array ($query) {return $this->arr = mysql_fetch_array ($  query);  /**** will release all memory ****/function Free_record ($query) {@mysql_free_result ($query) associated with result identifier results;  The/**** call specifies article list****/function Show_company_bringup () {$n = 1; $article _list = "Line_height."  > ";  $this->query = mysql_query ($this->sql);  while ($this->execute_row ($this->query)) {if ($this->showicon) {$article _list. = $this->icon;} $article _list. = "filename."   Php?id= ". $this->arr[0]." ' "; if ($this->showclueon) {$article _list. = "title=". $this->arr[1]. "'   ";}  if ($this->open) {$article _list. = "target= ' _blank '";}   $article _list. = ">"; if (strlen ($this->arr[1]) > $this->len) {if ($this->showomit) {$artIcle_list. = substr ($this->arr[1],0, $this->len). $this->omitstr;   }else{$article _list. = substr ($this->arr[1],0, $this->len);   }}else{$article _list. = $this->arr[1];  if ($this->showdate) {$article _list. = "[". $this->formatdate ($this->arr[2], $this->datetype). "]"; $article _list. = "
\ n "; if ($n = = $this->line) {break;} $n + +; if ($this->showmore) {$article _list. = "More_name.". Php?type= ". $this->type_name." >>> > more "; }else{$article _list. = ""; } $this->free_record ($this->query); Print $article _list; }}?>

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/1019064.html www.bkjia.com true http://www.bkjia.com/PHPjc/1019064.html techarticle based on the example analysis of the article class in the CMS of PHP, this paper describes the article class in the CMS based on PHP. Share to everyone for your reference. The specific analysis is as follows: php/*************** ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.