PHPCMS notes play 2, PHPCMS notes
You can use PHPCMS to insert templates and convert static sites to dynamic sites. It is good to add more exercises.
Separate the headers and tails of index.html and place them in the header.html and footer.html folders.
, Replace the original path with {IMG_PATH} images, {CSS_PATH} css, and {JS_PATH} js.
Header.html
Title replacement code
<title>{if isset($SEO['title']) && ! empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title>
Code for replacing the navigation menu in the header
<Div class = "header-items"> {if $ top_parentid = 0} <! -- Determine whether it is the homepage --> <a href = "{siteurl ($ siteid )} "> <div class =" h-item select "> homepage </div> </a> {else} <a href =" {siteurl ($ siteid )} "> <div class =" h-item "> homepage </div> </a> {/if} {pc: content action = "category" catid = "0" num = "6" siteid = "$ siteid" order = "listorder ASC"} {loop $ data $ r} {if $ catid = $ r [catid] | $ top_parentid = $ r [catid]} <div class = "h-item2">/</div> <a href = "{$ r [url]} "> <div class =" h-item select ">{$ r [catname] }</div> </a> {else} <div class =" h-item2 ">/</div> <a href =" {$ r [url]} "> <div class =" h-item ">{$ r [catname]} </div> </a> {/if} {/loop} {/pc} </div>
Index.html page
Replacement code for a larger image
<! -- Big chart start --> <div class = "bigimg"> {pc: content action = "lists" catid = "9" order = "id DESC" num = "1"} {loop $ data $ val} <! -- Thumb indicates the thumbnail --> <! -- Catid refers to the content under the topic. I put the image in the position of 9, so catid = "9" --> {/loop} {/pc} </div> <! -- The big picture ends -->
Click an image to enter the code of a title
<! -- Start with three items --> <div> <! -- 13 indicates the topic code --> <a href = "{$ CATEGORYS [13] [url]}"> </a> </div> <div class = "three-item"> <a href = "{$ CATEGORYS [11] [url]}"> {pc: content action = "lists" catid = "16" order = "id DESC" num = "1"} {loop $ data $ val} </a> </div>
Display item replacement code
<! -- Display item --> {pc: content action = "lists" catid = "14" order = "id DESC" num = "4" }{ loop $ data $ val} <div class = "dt-item"> <a href = "{$ val [url]}"> <div class = "dt-item-title"> {$ val [title]} </div> </> <div class = "dt-item-context" >{$ val [description] }</div> </div >{/ loop }{/pc}
Display item code 2
<! -- Excellent product display start --> <div class = "yxxm"> <div class = "yxxm-title"> excellent product display </div> {pc: content action = "lists" catid = "10" order = "id DESC" num = "6" moreinfo = "1"} {loop $ data $ val} <! -- Display item --> <div class = "yxxm-item"> <a href = "{$ val [url]}"> </a> <div class =" yxxm-name "> Project name: <span >{$ val [title] }</span> </div> <div class = "yxxm-user"> Customer: <span >{$ val [keywords] }</span> </div> <div class = "yxxm-context"> functions: <span> {php list ($ copyfrom) = explode ('|', $ val ['copyfrom'])} {$ copyfrom}
<! -- The above indicates the source, right? | 0 remove -->
</Span>
</div> </div> {/loop} {/pc}
This section div is used as an example to learn how to add time codes and how to add pages.
<Div class = "right"> <a href = "$ val [url]"> <div class = "list-title" >{$ CAT ['catname']} </div> </a> <! -- List item --> {pc: content action = "lists" catid = "$ catid" order = "id DESC" num = "10" page = "$ page"} {loop $ data $ val} <div class = "right-item"> <a href = "{$ val ['url']}"> <div class = "item-context"> {$ val ['title' ]} </div> </a> <div class = "item-time"> {date ('Y-m-d H: i: s', $ val [inputtime])} </div> </div >{/ loop} {/pc} <! -- Pagination --> <div class = "paging" >{$ pages} </div>
Add links
Link: {pc: link action = "type_list" typeid = "0" siteid = "1" linktype = "1" order = "listorder DESC" num = "4" return = "pic_link"} {loop $ pic_link $ v} <a href = "{$ v ['url']}" >{$ v ['name'] }</a >{/ loop }{/ pc}
We can use a single page for writing,