1. Intercept Call Header length
{Str_cut ($r [title],36, ']}
2. Format Time
Call format Time 2011-05-06 11:22:33
{Date (' y-m-d h:i:s ', $r [Inputtime])}
3. Multi-column Call & Multi-recommendation bit call
Call Requirements: The article range is 59 60 613 columns, and pushed to 27 and 282 recommended bits;
Starting with article three, 7 consecutive articles are invoked.
{pc:get sql= "select * from V9_news where id" (SELECT ID from V9_position_data where posid in (27,28) and CATID in (59,60,6) 1) Order by Listorder DESC "cache=" 3600 "start=" 3 "num=" 7 "return=" Data "}
{Loop $data $n $r}
<li>?<a target= "_blank" href= ' {$r [url]} ' title= ' {$r [title]} ' style= ' Color:black; ' >{str_cut ($r [title],22, "]}</a></li>
{/loop}
{/PC}
4. Display column name (just name, without link)
{$catname}
Display column name and link (can be clicked)
<a href= "{$CATEGORYS [$r [Catid]][url]}" >{$CATEGORYS [$r [' catid ']][' catname ']]}</a>
5. Get the parent column Id/get the parent column name
{$CATEGORY [$catid][parentid]}
Parent column Name: {$CATEGORYS [$CAT [Parentid]][catname]}
6. External data source calls
Dedecmsdb is added at the background data source
{pc:get sql= "SELECT * from Cq_member where mtype= ' Enterprise '" cache= "3600" dbsource= "Dedecmsdb" num= "7" return= "Data"}
{Loop $data $r}
<a href= "/member/index.php?uid={$r [userid]}" title= "{$r [uname]}" target= "_blank" >{str_cut ($r [uname],28, ')} </a>
{/loop}
{/PC}
7. Call Sub Column (in the Column homepage template need to use)
{pc:content action= "category" Catid= "$catid" num= "" siteid= "$siteid" order= "Listorder ASC"}
{Loop $data $r}
<a href= "{$r [url]}" >{$r [catname]}</a> |
{/loop}
{/PC}
8. Display the column name of the specified ID (example here catid=22)
{$CATEGORYS [22][' CatName ']}
9. Display the article category before the article
{pc:content action= "lists" catid= "order= listorder" DESC "14"}
<?php $TYPE = GetCache (' type_content ', ' Commons ');? >
{Loop $data $n $r}
<li>{if $TYPE [$r [Typeid]][name]}<span style= "color: #CC6600" >[{$TYPE [$r [Typeid]][name]}] </span> {/if}<a href= ' {$r [' url ']} ' {Title_style ($r [style])}title= ' {$r [' title ']} ' target= ' _blank ' >{str_cut ($r [title] ,}</a></li>, "")
{/loop}
{/PC}
10. Specify variable cycle growth (often used for slides)
{pc:content action= "lists catid=" order= "Listorder DESC" thumb= "1" num= "5"}
{php $num = 0}
{Loop $data $r}
linkarr[{$num}] = "{$r [url]}";
picarr[{$num}] = "{$r [thumb]}";
textarr[{$num}] = "{str_cut ($r [title],36, ')}";
{PHP $num + +}
{/loop}
{/PC}
11. Article Call using limit
{pc:content action= "position" posid= "num=" "1" order= "Listorder" DESC limit 1,1--"}
Others are used as before
{pc:content action= "position" posid= "order=" Listorder DESC "limit= ' 1,8--'}"
{Loop $data $r}
<li><a href= ' {$r [url]} ' title= ' {$r [title]} ' Target=_blank>{str_cut ($r [title],36, ']}</a></li >
{/loop}
{/PC}
12. The article starts at the specified location
The starting position is 5, and 3 is invoked. Equivalent to limit function.
{pc:content action= "position" posid= "a" order= "Listorder DESC" num= "3" start= "5"}
{Loop $data $r}
<a href= ' {$r [url]} ' >{str_cut ($r [description],115)} ... </a>
{/loop}
{/PC}
13. The article List page calls the keyword, or the first page calls the key word
Note: Explode (', ', $r [keywords]); is to separate the key words in English by commas, that is to say, each article should be a comma interval keyword, otherwise call out will be all as a keyword. If the space interval keyword is explode (', ', $r [keywords]), change to explode (', $r [keywords]);
{pc:content action= "lists" catid= "$catid" num= "" order= "id DESC" page= "$page"}
{Loop $data $r}
<a href= "{$r [url]}" >{$r [title]}</a>
{php $keywords = explode (', ', $r [keywords]);}
<b> Article label:</b>
{Loop $keywords $keyword}
<a href= "{app_path}index.php?m=content&c=tag&catid={$catid}&tag={urlencode ($keyword)}" class= " Blue "> {$keyword}</a>
{/loop}
{/loop}
{/PC}
14. When a list of several lines of time some symbols (such as the home page of the article recommended, a row shows two, in the middle of these two want to add a vertical line | To use this code)
A large number of words will be easy to make mistakes, because the model operation ~ ~ Hehe but generally also on the 4 titles below
{pc:content action= "position" posid= "8" order= "Listorder DESC" num= "2"}
{Loop $data $r}
<a style= "color: #040605" title= "{$r [title]} ' href= ' {$r [url]} ' Target=_blank>{str_cut ($r [title],26, ']}</a >{if $n%2==1} | {/if}
{/loop}
{/PC}
15.v9 List page perfectly supports custom segment calls
{pc:content action= "lists" catid= "$catid" num= "order=" id DESC "page=" $page "moreinfo=" 1 "}
{Loop $data $r}
<a href= "{$r [url]}" >[{$r [' field name ']}]> {$r [title]}</a>
{/loop}
<div class= "Pagebar" >{$pages}</div>
{/PC}
16. The current column calls the parent level and the following column information method
The other code should be the ground or the ground. It's a factor.
{php $arrchildid = $CATEGORYS [$CAT [Parentid]][arrchildid]}
{pc:get sql= ' select * from V9_news where catid in ($arrchildid) cache= "3600" page= "$page" num= "" "Return=" Data "}
17.v9 How to return the current page after the form feature is submitted instead of the default first file address
Find phpcms\modules\formguide\index.php file line 73rd
ShowMessage (L ('), App_path);
The following code can be changed to achieve automatic return to the previous page
ShowMessage (L ('), http_referer);
18.v9 Home page or pagination custom field call
Like 15.
First normal list or column call custom field
After {pc:content action= "lists" plus the secondary table moreinfo=1 (equal to 1 o'clock display, 0 o'clock does not show)
Example:
{pc:content action= "lists" Moreinfo=1 catid= "2" order= "id DESC" num= "4"}
<ul>
{Loop $data $key $val}
<li><a href= "{$val [' url ']}" >{$val [' title ']}</a>
<br> Price: {str_cut ($v [' Custom segment '],100]}//100 is the word number
</li>
{/loop}
</ul>
{/PC}
The second recommended bit calls the custom field
After you add the custom fields to the model, you must click "Yes" in the recommended bit label.
And then use the same method to adjust the data OK, remember, if you add the article, must go to update the article will show, the custom section in the recommendation only show you choose, add before the addition of the article does not show, update the article on the show
Example:
{pc:content action= "position" posid= "recommended bit ID" num= "" thumb= "1" moreinfo= "1" order= "Listorder DESC"}
{Loop $data $key $val}
<li><a href= ' {$val [' url ']} ' target= ' _blank ' ></a>
<a href= "{$val [' url ']}" target= "_blank" >{str_cut ($val [' title '],20)}</a></li>
{/loop}
{/PC}
20. Editor upload picture automatically use caption as ALT parameter
One: Modify Statics/js/ckeditor/plugins/image/dialogs/image.js
Found it
AccessKey: ' T ', ' Default ': '
Replace into
AccessKey: ' T ', ' Default ': $ (' #title '). Val ()
Two: Clear browser cache
21. Increase the number of random clicks on the article
Found 100 rows of $views = $r [' views '] +1
Modified to:
$rand _nums=rand (79,186);
$views = $r [' views '] + $rand _nums;
Say click once, increase 79 to 186 times
-------------------------------------------------------------
Tips: Some versions of the wrong folk solutions
1. Thumbnails and Atlas cannot be uploaded
\phpcms\libs\classes\attachment.class.php
Please put 24 lines (or maybe 23 lines)
$this->upload_func = ' copy ';
Change into
$this->upload_func = ' move_uploaded_file ';
2. Fragmentation module Search article not see the column
phpcms\modules\block\templates\search_content.tpl.php
13 lines changed into
<td><?php
if (Isset ($_get[' Dosubmit ')) {? ><div class= "RT" ><a
href= "javascript:void (0)" onclick= "$ (' #search '). Toggle ()" ><?php
echo L (' folded_up_in_search_of ')? ></a></div><?php}
Echo form::select_category (', $catid, ' name= ' catid ' id= ' catid ', ', ', '
', ' 0 ', 1?> </td>
22, Phpcms V9 get tag call
1, call the system a single piece of data, example (call ID 1 information, the title length of not more than 25 characters, display update date):
{Get sql= ' select * from phpcms_content where contentid=1 '/}
Title: {str_cut ($r [title],)} url:{$r [URL]} Update Date: {date (' y-m-d ', $r [UpdateTime])}
2, call the system more than one data, example (call column ID 1 through the audit of 10 information, the title length of not more than 25 characters, display update date):
{Get sql= ' select * from Phpcms_content where catid=1 and status=99 order by UpdateTime ' desc ' 10}
Title: {str_cut ($r [title],)} url:{$r [URL]} Update Date: {date (' y-m-d ', $r [UpdateTime])}
{/get}
3, with pagination, example (call column ID 1 through the audit of 10 information, the title length of not more than 25 characters, showing the update date, with pagination):
{Get sql= ' select * from Phpcms_content where catid=1 and status=99 order by updatetime Desc ' rows= ' "$page"}
Title: {str_cut ($r [title],)} url:{$r [URL]} Update Date: {date (' y-m-d ', $r [UpdateTime])}
{/get}
Paging: {$pages}
4, custom return variable, example (call column ID 1 through the audit of 10 information, the title length of not more than 25 characters, display update date, return variable for $v):
{Get sql= ' select * from Phpcms_content where catid=1 and status=99 order by updatetime Desc ' rows= ' return= ' V '}
Title: {str_cut ($v [title],)} url:{$v [URL]} Update Date: {date (' y-m-d ', $v [UpdateTime])}
{/get}
5, call the same account under the other database, example (call the database for the BBS, category ID 1 of the 10 latest topics, the theme length of not more than 25 characters, show the update date):
{Get Dbname= "BBS" sql= "select * from Cdb_threads where fid=1 order by dateline Desc" rows= "10"}
Topic: {str_cut ($r [subject], M)} url:http://bbs.phpcms.cn/viewthread.php?tid={[Tid]} Update Date: {date (' y-m-d ', $r [ Dateline])}
{/get}
6, call the external data, example (call the data source for the BBS, category ID 1 of the 10 latest topics, the theme length of not more than 25 characters, show the update date):
{Get dbsource= "BBS" sql= "select * from Cdb_threads where fid=1 order by dateline Desc" rows= "10"}
Topic: {str_cut ($r [subject], M)} url:http://bbs.phpcms.cn/viewthread.php?tid={[Tid]} Update Date: {date (' y-m-d ', $r [ Dateline])}
{/get}
Do not know whether there are friends in the use of these several methods can not meet the needs of the time.
For example: Take out the most commented 3rd to 10th record, some people say that I am superfluous, generally get the most comments there is no reason not to take the first and second, because the phpcms thumbnail for 4:3 of such size is better, the long shape (such as 3:4) of the picture thumbnail effect is not good, To manually update the first and second records with the most comments, you do not want to automatically update the top two entries.
<ul>
<!--{get sql= "select A.contentid,a.catid,a.title,a.thumb,a.description,a.url,a.status,a.updatetime, B.contentid,b.hits,b.comments from ' phpcms_content ' as A INNER JOIN ' Phpcms_content_count ' as B on A.contentid=b.contenti D and A.status=99 and LENGTH (A.THUMB) >0 ORDER BY b.comments desc LIMIT "3,7"
<li><span class= "Xxnse_fen2" >{$r [comments]} people participating in comment </span>?<a href= "{$r [url]} ' title= ' {$r [title ]} ">{str_cut" ($r [title],}</a></li>
<!--{/get}-->
</ul>
The key point is in the order by b.comments Desc LIMIT 3,7 (indicating that 7 data is read down from the 3rd record). This is often used in MySQL, I hold to try the idea, the result is possible.
The effect is as follows:
Hope to be a friend of Phpcms development to learn and share together
Phpcms V9 retains the use of a 2008 get tag
It consists of 2 ways, one is internal data, the other is external data
Let's first analyze how to use the internal data.
1, the internal data call
{pc:get sql= ' select * from ' XX ' WHERE FID = $ltid and digest =2 and ifupload the order by =1 Tid ' DESC ' 2 ' num= ' cache= ' r eturn= "Data"}
{Loop $data $r}
。。。。。
{/LOOP}{/PC}
This shows that the GET statement supports the use of NUM but does not support limit 5,5. This usage
It's really a shame.
Num is the number of bars called
2, the external data call
{Pc:get sql = "SELECT * Phpcms_member" cache = "3600" page = "$page" Dbsource = "discuz" return = "Data"}
<ul>
{Loop $data $key $val}
{$val [username]}< br/>
{/loop}
</ul >
{$pages}
{/PC}
One is the data source, one is the resulting pages page effect