Phpcms V9 two times development and use of various problem solving solutions (II.)
Template invocation
1, the content tag, the number 123456789 call?
{pc:content action= "lists" catid= "$catid" order= "id DESC" num= "10"} {Loop $data $k $v} <li>{$n}<a href= "{$v <a href=" Http://www.lai18.com/content/%7D ">{str_cut ($v [' title ' ],44, ')}<= "" a><= "" Li> {/loop}
<a href= "Http://www.lai18.com/content/%7D" >{str_cut ($v [' title '],44, ')}<= "" a><= "" li>{php $j = 1;} {pc:content action= "lists" catid= "$catid" order= "id DESC" num= "10"} {Loop $data $v} <li>{$j}<a href= "{$v [url]}" >{str_cut ($v [' title '],44, ')}</a></li>{$j ++}{/ Loop
<a href= "Http://www.lai18.com/content/%7D" >{str_cut ($v [' title '],44, ')}<= "" a><= "" Li>2, Article List title Display control of length (or word count)
You can use the Strcut function for interception, whether it is the title or otherwise, as follows:
{strcut ($v [' title '],40, ')} is intercepted backwards, {str_cut ($v [' title '],40, ')} is intercepted forward. This is the length of the cut text, if you do not want to display three points, that is, 40 (the number of characters cut) followed by a comma (,), and the quotation mark content is empty, if you want to become something else, such as a type, then the quotation marks in the type. GBK a Chinese character is 2 characters, UTF version a Chinese character occupies 3 characters, note the number of characters that encode and then set the cut.
3, circular Call column level two and three column name
4. Display the article details on the homepage or list page
Moreinfo=1
5. Display the latest articles in certain designated fields
{pc:get sql= "select * from Phpcms_news WHERE catid in (12,13,14,15,16,17,18) ORDER by ID DESC" num= "ten" return= "Data"} {Loop $data $k $r} <li><a href= "{$CATEGORYS [$r [Catid]][url]}" >[{$CATEGORYS [$r [catid]][catname]}]</a ><a href= "{$r [url]}" target= "_blank" >{$r [title]}</a></li> {/LOOP}{/PC}
6. Click on the leaderboard to specify the channel ID
7, Separate call column link
8. Whether the column is the top column (with sub-columns)
{if $top _parentid} {/if}
9, click Call 10, the attention of curly braces
In order not to conflict with template parsing, curly braces should be written in 2 lines, for example:
{}//error {correct}
<a href= "Http://www.lai18.com/content/%7D" >{str_cut ($v [' title '],44, ')}<= "" a><= "" li>10, Home default slide focus does not appear
File name capitalization causes the workaround:
File \statics\js\jquery.sgallery.js Modify Jquery.sgallery.js
11. Different member models call different templates
Open phpcms\modules\member\index.php on line 30th to find the Include template (' member ', ' Index '); Revision changed to
if ($memberinfo [modelid]==10) {
Include template (' member ', ' Index (here is the original Member Model template) ');
}
else{
Include template (' member ', ' indexxxx (here is a template for another membership model) ');
}
Copy Code
11. Time Format
Formatted Time 2011-05-06 11:22:33
{Date (' y-m-d h:i:s ', $r [Inputtime])}
Formatted time May 06, 2011
{Date (' Y year m D Day ', $r [Inputtime])}
12. Forum Data call
13. Class Call method
{pc:content action= "lists" catid= "" order= "Listorder DESC" num= "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}
Copy Code
14. Fragments
15, the Call of the photos
16, member information call
17, only call the recommended links
Call all, judge the value of the elite in the loop loop, or call with the get tag
18, call the first level column
Specify catid= "0"
19, the first page calls multi-column recommended content
{pc:get sql= "select * from ' v9_news ' A, ' V9_position_data ' P WHERE a.id=p.id and Posid=14 and A.catid in (6,11) ORDER by a. UpdateTime DESC "num=" 10 "}
{Loop $data $r}
<li><a href= "{$CATEGORYS [$r [Catid]][url]}" target= "_blank" >{$CATEGORYS [$r [catid]][catname]}</a ><font title= "{date (' y-m-d ', $r [inputtime])}" > {date (' d ', $r [Inputtime])} Day </font></span><a href= "{$r [url]}" >{$r [title]}</a></li>
{/loop}
{/PC}
Copy Code
20. Usage of subcat function
21. List page classified by time
22. Ranking of Members
{Get sql= ' select ' userid ', ' username ', ' areaid ', ' Amount ', ' point ', ' modelid ' from ' Phpcms_member_cache ' ORDER by ' point ' DESC "rows=" 10 "}
Copy Code
23. Some usages of if
{if $n ==2 | | $n ==3} {/if}
This is in points to row ..., try to use ha! {$r [username]}
24, the current column calls the parent and the following column information
{php $arrchildid = $CATEGORYS [$CAT [Parentid]][arrchildid]}
{pc:get sql= "select * from V9_news where catid in ($arrchildid) cache=" 3600 "page=" $page "num=" \ "return=" Data "}
Copy Code
25, the content page calls the "content paging" the current page, such as [2/20] method
You want to call the content page {current page} {total pages} separately
For example the article title "The domestic economy again take off [1/5]", the domestic economy take off again [{$page}/{$pagenumber}]
26, call the latest content of the whole station
Read more than one table in the same field with the latest n, sort by inputtime, click to view "TARGET=_BLANK>}" >{str_cut ($v [' title '],44, ')}</a></li>
{/loop}
Copy Code
Or
{php $j = 1;}
{pc:content action= "lists" catid= "$catid" order= "id DESC" num= "10"}
{Loop $data $v}
<li>{$j}<a href= "{$v [url]}" >{str_cut ($v [' title '],44, ')}</a></li>
{$j + +}
{/loop}
Copy Code
2, the article List title shows the length (or the number of words) control
You can use the Strcut function for interception, whether it is the title or otherwise, as follows:
{strcut ($v [' title '],40, ')} is intercepted backwards, {str_cut ($v [' title '],40, ')} is intercepted forward. This is the length of the cut text, if you do not want to display three points, that is, 40 (the number of characters cut) followed by a comma (,), and the quotation mark content is empty, if you want to become something else, such as a type, then the quotation marks in the type. GBK a Chinese character is 2 characters, UTF version a Chinese character occupies 3 characters, note the number of characters that encode and then set the cut.
3, circular Call column level two and three column name
4. Display the article details on the homepage or list page
Moreinfo=1
5. Display the latest articles in certain designated fields
{pc:get sql= "select * from Phpcms_news WHERE catid in (12,13,14,15,16,17,18) ORDER by ID DESC" num= "ten" return= "Data"}
{Loop $data $k $r}
<li><a href= "{$CATEGORYS [$r [Catid]][url]}" >[{$CATEGORYS [$r [Catid]][catname]}]</a><a href=] { $r [url]} "target=" _blank ">{$r [title]}</a></li>
{/loop}
{/PC}
Copy Code
6. Click on the leaderboard to specify the channel ID
7, Separate call column link
8. Whether the column is the top column (with sub-columns)
{if $top _parentid} {/if}
Copy Code
9, click Call 10, the attention of curly braces
In order not to conflict with template parsing, curly braces should be written in 2 lines, for example:
{}//Error
{Correct
}
10. Home default slide focus is not displayed
File name capitalization causes the workaround:
File \statics\js\jquery.sgallery.js Modify Jquery.sgallery.js
11. Different member models call different templates
Open phpcms\modules\member\index.php on line 30th to find the Include template (' member ', ' Index '); Revision changed to
if ($memberinfo [modelid]==10] {include template (' member ', ' Index (here is the original Member Model template) '); Else{include template (' member ', ' indexxxx (here is another form of membership model) ');}
11. Time Format
Formatted Time 2011-05-06 11:22:33
{Date (' y-m-d h:i:s ', $r [Inputtime])}
Formatted time May 06, 2011
{Date (' Y year m D Day ', $r [Inputtime])}
12. Forum Data call
13. Class Call method
{pc:content action= "lists" catid= "" order= "Listorder DESC" num= "}<?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],33, ')}</A></LI>{/LOOP}{/PC}
14. Fragments
15, the Call of the photos
16, member information call
17, only call the recommended links
Call all, judge the value of the elite in the loop loop, or call with the get tag
18, call the first level column
Specify catid= "0"
19, the first page calls multi-column recommended content
{
Pc:get sql= "select * from ' v9_news ' A, ' V9_position_data ' P WHERE a.id=p.id and Posid=14 and A.catid in (6,11) ORDER by a.u Pdatetime DESC "num="}{loop $data $r}<li><a href= "{$CATEGORYS [$r [Catid]][url]}" target= "_blank" >{$ categorys[$r [Catid]][catname]}</a><font title= "{date (' y-m-d ', $r [inputtime])} ' > {date (' d ', $r [ Inputtime]} day </font></span><a href= "{$r [url]}" >{$r [TITLE]}</A></LI>{/LOOP}{/PC}
20. Usage of subcat function
21. List page classified by time
22. Ranking of Members
{Get sql= ' select ' userid ', ' username ', ' areaid ', ' Amount ', ' point ', ' modelid ' from ' Phpcms_member_cache ' ORDER by ' point ' DESC "rows=" 10 "}
23. Some usages of if
{if $n ==2 | | $n ==3} {/if}
This is in points to row ..., try to use ha! {$r [username]}
24, the current column calls the parent and the following column information
{php $arrchildid = $CATEGORYS [$CAT [Parentid]][arrchildid]} {pc:get sql= "select * from V9_news where catid in ($arrchildid) cache=" 3600 "page=" $page "num=" \ "return=" Data "}
25, the content page calls the "content paging" the current page, such as [2/20] method
You want to call the content page {current page} {total pages} separately
For example the article title "The domestic economy again take off [1/5]", the domestic economy take off again [{$page}/{$pagenumber}]
26, call the latest content of the whole station
Read more than one table in the same field to the latest n, sort by inputtime, [url=http://bbs.phpcms.cn/viewthread.php?tid=296531] Click to view
27, one-time search all site model content
28. Call other site-specific content
Add the data source in the background and then use the get call to
29, [url=http://bbs.phpcms.cn/viewthread.php?tid=279355]wshxh Summary 1 wshxh Summary 1
30. Call All Navigation
{pc:content action= "category" catid= "0" num= "siteid=" $siteid "order=" Listorder ASC "}<ul class=" Nav-site "> <li><a href= "{SiteURL ($siteid)}" ><span> home </span></a></li>{loop $data $r} < Li class= "line" >|</li> <li><a href= "{$r [url]}" ><span>{$r [catname]}</span></a ></LI>{/LOOP}</UL>{/PC}
31, the total station display Lists List label article number of hits
Common lists tag code (suitable for column):
{pc:content action= "lists" catid= "$catid" num= "ten" order= "ID DESC"} {Loop $data $r} {PHP $h _md=pc_base::load_model (' Hits_model '); $get _db= $h _md->get_one (Array (' hitsid ' = "C". $modelid. " -". $r [id])); $views = $get _db[views];} Click: {$views}{/LOOP}{/PC}
The first page is called because the model ID is required, so you need to:
Get_one (Array (' hitsid ' = "C". $modelid. " -". $r [id]));
Switch
Get_one (Array (' hitsid ' = "c-1-". $r [id]));
1 for the current lists call column belongs to the model ID, the system comes with the article system is 1, custom model please modify according to your own.
$r [ID] modified according to the actual situation.
32, show the total station leaderboard, display collection statistics
{pc:get sql= "select *,count (*) as Count from Phpcms_favorite where Adddate>=date_sub (Curdate (), INTERVAL WEEKDAY ( Curdate ()) day) group by title Order by COUNT (*) desc "return=" Data "num=" 9 "}<ul>{loop $data $key $val} <LI>&L T;a href= "{str_replace ('/index.html ', '", $val [url])} "target=" _blank "title=" {$val [title]} ">{$val [title]}</a > {$val [COUNT]}</LI>{/LOOP}</UL>{/PC}
33, the page code of Select
{pc:content action= "lists" catid= "$catid" num= "+" order= "id DESC" return= "data1" page= "$page"}<select name= "Select _pages "onchange=" Location.href=this.options[this.selectedindex].value; " >{loop $data $r 1}{/loop}{str_replace ("a href", "option Value", Str_replace ("..", "", Str_replace ("</a", "</ Option ", Str_replace (" A Class "," option Class ", Str_replace (" </span> "," Page </option> ", Str_replace (" < Span> "," <option selected>//", Str_replace (" > "," > ", $pages)))))))))))))))))
The above is Phpcms v9 two times development and use of various problem Solutions (ii) content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!