xml Miva - 使用Sebenza模板模块进行URI管理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Miva - 使用Sebenza模板模块进行URI管理相关的知识,希望对你有一定的参考价值。

<mvt:if expr="g.debug">
	<!-- !@! Pre-Render | Install https://github.com/ghassani/miva-global-pre-render -->
</mvt:if>

<mvt:comment><!-- Check the URI (Lets see if we need to assign g.Category_Code or g.Product Code for Sebenza's Category/Product Template Manager module) --></mvt:comment>

	<mvt:assign name="l.prerender_request_uri" value="gettoken( s.request_uri, '?', 1 )" />
	<mvt:do file="g.Module_Feature_URI_DB" name="l.settings:has_uri" value="URI_Load_URI( l.prerender_request_uri, l.settings:uri )" />
	<mvt:if expr="g.debug">
		<!--
			URI_Load_URI:&mvt:has_uri;
			URI:<mvt:eval expr="l.prerender_request_uri"/>
			<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:uri), ',', '<br>'))" />
		-->
	</mvt:if>


<mvt:comment><!-- If the URI lookup identified a category, then lets assign g.Category_Code for Sebenza Template module --></mvt:comment>
	<mvt:if expr="l.settings:uri:cat_id">
		<mvt:do name="l.settings:has_category" file="g.Module_Library_DB" value="Category_Load_ID( l.settings:uri:cat_id, l.settings:category )" />
		<mvt:if expr="l.settings:has_category">
			<mvt:assign name="g.Category_Code" value="l.settings:category:code" />
		</mvt:if>

		<mvt:if expr="g.debug">
			<!--
				Category_Load_ID:&mvte:has_category;
				<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:category), ',', '<br>'))" />
			-->
		</mvt:if>
	</mvt:if>

<mvt:comment><!-- If the URI lookup identified a product, then lets assign g.Product_Code for Sebenza Template module --></mvt:comment>
	<mvt:if expr="l.settings:uri:product_id">
		<mvt:do name="l.settings:has_product" file="g.Module_Library_DB" value="Product_Load_ID( l.settings:uri:product_id, l.settings:product )" />
		<mvt:if expr="l.settings:has_product">
			<mvt:assign name="g.Product_Code" value="l.settings:product:code" />
		</mvt:if>

		<mvt:if expr="g.debug">
			<!--
				Product_Load_ID:&mvte:has_product;
				<mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:product), ',', '<br>'))" />
			-->
		</mvt:if>
	</mvt:if>

<mvt:if expr="g.debug">
	<!--
	Pre-Render Determined:
	Category_Code:&mvte:global:Category_Code;
	Product_Code:&mvte:global:Product_Code;
	-->
</mvt:if>




<mvt:comment>
	<!-- This is more simple method of getting the category/product code. Doesn't leverage Miva's URI management (as above) -->
	<!--
		<mvt:assign name="g.Prefix" value="gettoken( l.prerender_request_uri, '/', 2 )" />
		<mvt:assign name="g.Code" value="gettoken( l.prerender_request_uri, '/', 3 )" />

		<mvt:if expr="g.Prefix EQ 'c'">
			<mvt:assign name="g.Category_Code" value="g.Code" />
		<mvt:elseif expr="g.Prefix EQ 'p'">
			<mvt:assign name="g.Product_Code" value="g.Code" />
		</mvt:if>
	-->
</mvt:comment>

以上是关于xml Miva - 使用Sebenza模板模块进行URI管理的主要内容,如果未能解决你的问题,请参考以下文章

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

xml Sebenza评论与Schema

xml Sebenza评论与Schema

xml Miva - 模板饲料 - variant_id,促销价和变种价格

xml Miva - mvt:做模块加载ID和模块加载代码

xml Miva - 一个模块中所有功能的示例