xml Miva - 自定义XML站点地图

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Miva - 自定义XML站点地图相关的知识,希望对你有一定的参考价值。

<mvt:comment><!-- Sitemap | File Output: /sitemap.xml --></mvt:comment>

<mvt:assign name="g.tab" value="asciichar(9)"/>
<mvt:assign name="g.newline" value="asciichar(10)"/>
<mvt:assign name="g.pipe" value="asciichar(124)"/>
<mvt:assign name="g.comma" value="asciichar(44)"/>
<mvt:assign name="g.quote" value="asciichar(34)"/>
<mvt:assign name="g.period" value="asciichar(46)"/>
<mvt:assign name="g.delimiter" value="asciichar(9)"/>
<mvt:assign name="g.lessthan" value="asciichar(60)"/>
<mvt:assign name="g.greaterthan" value="asciichar(62)"/>

<mvt:assign name="g.filename" value="'sitemap.xml'"/>
<mvt:assign name="g.filepath" value="'/'"/>
<mvt:assign name="g.file_header" value="g.lessthan $ '?xml version=' $ g.quote $ '1.0' $ g.quote $ ' encoding=' $ g.quote $ 'UTF-8' $ g.quote $ '?' $ g.greaterthan $ g.lessthan $ 'urlset xmlns=' $ g.quote $ 'http://www.sitemaps.org/schemas/sitemap/0.9' $ g.quote $ ' xmlns:image=' $ g.quote $ 'http://www.google.com/schemas/sitemap-image/1.1' $ g.quote $ g.greaterthan"/>


<mvt:comment><!-- Delete File if it exists, create new file with header row --></mvt:comment>
<mvt:assign name="g.file_exists" value="sexists(g.filepath $ g.filename)"/>
<mvt:if expr="g.file_exists">
	<mvt:assign name="g.file_deleted" value="sdelete(g.filepath $ g.filename)"/>
	<mvt:if expr="g.file_deleted">
		<mvt:assign name="g.file_created" value="file_create(g.filepath $ g.filename, 'script', g.file_header)"/>
	</mvt:if>
<mvt:else>
	<mvt:assign name="g.file_created" value="file_create(g.filepath $ g.filename, 'script', g.file_header)"/>
</mvt:if>


<mvt:comment><!-- PRODUCTS & THEIR IMAGES--></mvt:comment>
<mvt:comment><!-- <mvt:item name="ry_toolbelt" param="assign|g.sql_select_products|'SELECT product.code AS code, page.name AS seoname FROM  s01_Products AS product LEFT JOIN s01_PageFinderProducts AS page ON product.id = page.product_id WHERE product.active = 1'" /> --></mvt:comment>
<mvt:item name="ry_toolbelt" param="assign|g.sql_select_products|'SELECT p.code code, pf.name seoname, p.thumbnail, p.image, i.image as aimage, p.name AS name FROM s01_ProductImages pxi JOIN s01_Products p ON p.id = pxi.product_id JOIN s01_Images i ON pxi.image_id = i.id JOIN s01_PageFinderProducts pf ON pf.product_id = p.id WHERE p.active = 1'" />
<mvt:item name="ry_toolbelt" param="query|g.sql_select_products|product_results" />
<mvt:assign name="g.current_product_code" value="''" />
<mvt:assign name="g.product_count" value="0" />
<mvt:assign name="g.image_count" value="0" />


<mvt:if expr="NOT ISNULL l.settings:product_results">

	<mvt:foreach iterator="product" array="product_results">
		<mvt:assign name="g.file_row" value="''" />

		<mvt:if expr="g.current_product_code NE l.settings:product:code">
			<mvt:if expr="g.product_count GT 0">
				<mvt:assign name="g.file_row" value="g.lessthan $ '/url' $ g.greaterthan" />
			</mvt:if>
			<mvt:assign name="g.file_row" value="g.file_row $ g.lessthan $ 'url' $ g.greaterthan $ g.lessthan $ 'loc' $ g.greaterthan $ 'http://' $ g.domain:name $ '/' $ l.settings:product:seoname $ '.html' $ g.lessthan $ '/loc' $ g.greaterthan $ g.lessthan $ 'lastmod' $ g.greaterthan $ '2014-03-10' $ g.lessthan $ '/lastmod' $ g.greaterthan $ g.lessthan $ 'changefreq' $ g.greaterthan $ 'monthly' $ g.lessthan $ '/changefreq' $ g.greaterthan $ g.lessthan $ 'priority' $ g.greaterthan $ '0.8' $ g.lessthan $ '/priority' $ g.greaterthan" />
			<mvt:assign name="g.current_product_code" value="l.settings:product:code" />
			<mvt:assign name="g.product_count" value="g.product_count + 1"/>
		</mvt:if>

		<mvt:assign name="g.file_row" value="g.file_row $ g.lessthan $ 'image:image' $ g.greaterthan $ g.lessthan $ 'image:loc' $ g.greaterthan $ 'http://' $ g.domain:name $ '/mm5/' $ l.settings:product:aimage $ g.lessthan $ '/image:loc' $ g.greaterthan $ g.lessthan $ 'image:title' $ g.greaterthan $ encodeentities(l.settings:product:name) $ g.lessthan $ '/image:title' $ g.greaterthan $ g.lessthan $ '/image:image' $ g.greaterthan" />
		<mvt:assign name="g.image_count" value="g.image_count + 1" />

		<mvt:assign name="g.write_line" value="file_append( g.filepath $ g.filename, 'script', g.file_row )"/>
	</mvt:foreach>

	<mvt:if expr="g.product_count GT 0">
		<mvt:assign name="g.file_row" value="g.lessthan $ '/url' $ g.greaterthan" />
		<mvt:assign name="g.write_line" value="file_append( g.filepath $ g.filename, 'script', g.file_row )"/>
	</mvt:if>
</mvt:if>


<mvt:comment><!-- CATEGORIES --></mvt:comment>
<mvt:item name="ry_toolbelt" param="assign|g.sql_select_categories|'SELECT category.code AS code, page.name AS seoname FROM  s01_Categories AS category LEFT JOIN s01_PageFinderCats AS page ON category.id = page.cat_id WHERE category.active = 1'" />
<mvt:item name="ry_toolbelt" param="query|g.sql_select_categories|category_results" />

<mvt:if expr="NOT ISNULL l.settings:category_results">
	<mvt:foreach iterator="category" array="category_results">
		<mvt:assign name="g.file_row" value="g.lessthan $ 'url' $ g.greaterthan $ g.lessthan $ 'loc' $ g.greaterthan $ 'http://' $ g.domain:name $ '/' $ l.settings:category:seoname $ '.html' $ g.lessthan $ '/loc' $ g.greaterthan $ g.lessthan $ 'lastmod' $ g.greaterthan $ '2014-03-10' $ g.lessthan $ '/lastmod' $ g.greaterthan $ g.lessthan $ 'changefreq' $ g.greaterthan $ 'monthly' $ g.lessthan $ '/changefreq' $ g.greaterthan $ g.lessthan $ 'priority' $ g.greaterthan $ '0.8' $ g.lessthan $ '/priority' $ g.greaterthan $ g.lessthan $ '/url' $ g.greaterthan" />
		<mvt:assign name="g.write_line" value="file_append( g.filepath $ g.filename, 'script', g.file_row )"/>
		<mvt:assign name="g.category_count" value="g.category_count + 1"/>
	</mvt:foreach>
</mvt:if>

<mvt:assign name="g.file_footer" value="g.lessthan $ '/urlset' $ g.greaterthan"/>
<mvt:assign name="g.write_line" value="file_append( g.filepath $ g.filename, 'script', g.file_footer )"/>

&mvte:global:product_count; products exported. <br>
&mvte:global:image_count; images exported. <br>
&mvte:global:category_count; categories exported. <br>
<mvt:comment>
	Car Type: &mvte:global:car_type; <br>
	Feed Type: &mvte:global:feed_type; <br><br>
</mvt:comment>

<a href="http://&mvte:global:domain:name;&mvte:global:filepath;&mvt:global:filename;" target="_blank"> http://&mvte:global:domain:name;&mvte:global:filepath;&mvt:global:filename; </a>

以上是关于xml Miva - 自定义XML站点地图的主要内容,如果未能解决你的问题,请参考以下文章

xml Miva - 自定义SearchSpring Feed

xml Miva - 自定义维护模式重定向

xml Miva - 从组中加载所有自定义字段

xml Miva - 在URI模板中加载自定义字段

xml Miva - 变异篮子项目替换与自定义领域排除产品

xml Miva - 将所有产品自定义域代码加载为成员名称