Request Address Http://127.0.0.1/phpcms/index.php?m=content&c=index&a=show&catid=6&id=8
First to determine the address corresponding to the data table
Consult the PHPCMS V9 Datasheet structure Manual http://v9.help.phpcms.cn/html/2010/database_1228/107.html can tell that we're going to take out news,v9_news_data Two data in a table
The next step is to understand how the data is removed.
The associated controller is as follows
This is relatively simple to call the content module under the index controller's Show method data sheet structure manual
The next step describes how the show () method operates the database
Request Parameter Catid=6&id=6
And we already know that the article is stored in the Article Model table News,news_data table id=6 this line,
CATID for column ID query data sheet structure manual or open database can find _category column table can easily find
The article model for each column is defined by the ModelID field
Re-check the manual to confirm the modelid corresponding table model
So the request parameter is converted to a parameter in show () modelid=1&id=6
At this point we know to get =6 information in table News,news_data
Here's the operation database.
$tablename = $this->db->table_name = $this->db->db_tablepre. $MODEL [$modelid] [' tablename ']; $r = $this- >db->get_one (Array (' id ' = = $id), if (! $r | | $r [' status ']! =) ShowMessage (L (' info_does_not_exists '), ' blank ' ); $this->db->table_name = $tablename. ' _data '; $r 2 = $this->db->get_one (array (' id ' = = $id); $rs = $r 2? Array_merge ($r, $r 2): $r;
Remove Main Table contents and schedule contents
Where the Get_one method is implemented in the Mysql.class.php database class
$content _output = new Content_output ($modelid, $catid, $CATEGORYS);
$data = $content _output->get ($rs); If there is a cache, the read cache has no output $rs
Extract ($data); This is the function of PHP itself to use this function to import variables from the array into the current symbol table
<?php/* assumes that the $var _array is the array returned by the wddx_deserialize */$size = "large"; $var _array = Array ("Color" = "Blue", "size"
=> "Medium", "shape" = "sphere") Extract ($var _array, Extr_prefix_same, "WDDX"), echo "$color, $size, $ Shape, $wddx _size\n ";? >
Blue, large, sphere, medium
It's easier to look at the template file again.
<Divclass= "Main"> <Divclass= "Col-left"> <Divclass= "Crumbs"><ahref= "{SiteURL ($siteid)}"><?php echo $title?>Home</a><span> > </span>{Catpos ($catid)} body</Div> <DivID= "article"> <H1>{$title}<BR/><span>{$inputtime} Source: {$copyfrom} Comments:<ahref= "#comment_iframe"ID= "comment">0</a>Click:</span><spanID= "hits"></span></H1>{if $description}<Divclass= "Summary" >{$description}</Div>{/if}<Divclass= "Content">{if $allow _visitor==1} {$content}