PHPCMS Simple way to make a website map

Published: 2015-06-19 15:00:41 Author: Anonymous I would like to comment
This article mainly introduces the PHPCMS to make a simple method of site map, this article gives the operation steps and label source code, the need of friends can refer to

PHPCMS default seems to have no sitemap label, but when the site column division is very fine, the sitemap is still very necessary, conducive to search engine crawling. Today, Creative Studio is sharing a simple way to implement sitemaps! First of all, we add a new column or add a single page in the column (here to add a single page as a demonstration) and set it not to display in the navigation, the template is manually set to page_sitemap.html, the generation rule is set as follows, and then add the following label in the appropriate position of page_sitemap.html.

Copy code
The code is as follows:

{pc:content action="category" catid="0" num="10" siteid="$siteid" order="listorder ASC"}
<h2><a href="{siteurl($siteid)}"> Home page </a>
{loop $data $r}
<h2><a href="{$r[url]}">{$r[catname]}</a></h2>
{if $top_parentid}
{pc:content action="category" catid="$r[catid]" num="15" siteid="$siteid" order="listorder ASC"}
{loop $data $v}
<p><a href="{$v[url]}">{$v[catname]}</a></p>
{/loop}
{/pc}
{/if}
{/loop}
{/pc}

So, is it easy? The demonstration can be seen in the picture:

Article extension

Many children's shoes after reading this article will: "Which if I have three columns then how to get it"? OK, we will improve it today, and the code is as follows:

Copy code
The code is as follows:

{pc:content action="category" catid="0" num="250" siteid="$siteid" order="listorder ASC"}
<h2><a href="{siteurl($siteid)}"> Home page </a>
{loop $data $r}
<h2><a href="{$r[url]}">{$r[catname]}</a></h2>
{if $top_parentid}
{pc:content action="category" catid="$r[catid]" num="150" siteid="$siteid" order="listorder ASC"}
{loop $data $t}
<dl class="left">
<dt><a href="{$t[url]}">{$t[catname]}</a></dt>
{if $t[child]}
{pc:content action="category" catid="$t[catid]" num="150" siteid="$siteid" order="listorder ASC"}
{loop $data $v}
<dd><a href="{$v[url]}">{$v[catname]}</a></dd>
{/loop}
{/pc}
{/if}
</dl>
{/loop}
{/pc}
{/if}
{/loop}
{/pc}

  • Tag: Phpcms site map

Related article

Latest comments