我对Umbraco来说非常新,没有做Xslt或javascripting。 我有不止一个网站提供综合监测系统。 但是,主要内容相同,标语不同。 为了解决这一问题,我谨提出一些宏观或守则,以检索网站域名,并以这个域名为基础,在Umbraco模板中打上适当的旗帜。 让我知道这是否可行以及如何做到这一点。 如果这样做不可行,则不可行。
Kind Regards Brainbox
我对Umbraco来说非常新,没有做Xslt或javascripting。 我有不止一个网站提供综合监测系统。 但是,主要内容相同,标语不同。 为了解决这一问题,我谨提出一些宏观或守则,以检索网站域名,并以这个域名为基础,在Umbraco模板中打上适当的旗帜。 让我知道这是否可行以及如何做到这一点。 如果这样做不可行,则不可行。
Kind Regards Brainbox
你可以采取几种办法。
<> 如果各站点使用不同的模板,但采用相同的宏观(方法0):
然后在宏观(开发商科)上添加一个比值,从而更新该代码。
Template:
<umbraco:Macro Alias="MyMacro" runat="server" MyParam="Hello, world" />
XSLT:
<xsl:value-of select="/macro/MyParam" />
<>> 如果这些地点使用同样的模板和宏观(方法1):
您可以利用图书馆检索主机名称,并在此基础上执行不同的法规。 在内容部分中为每个不同地点设定一个节点,并上载该栏的标语,然后通过各自的代号编号在XSLT中提及。
XSLT:
<!-- this gets the domain name -->
<xsl:variable name="domainName">
<xsl:value-of select="umbraco.library:RequestServerVariables( HTTP_HOST )" />
</xsl:variable>
<!-- determine which banner to show -->
<xsl:choose>
<xsl:when test="$domainName = www.websiteone.com ">
<!-- get the node for website one -->
<xsl:variable name="websiteOneHeaderNodeId" select="1001" />
<xsl:variable name="websiteOneHeaderNode" select="umbraco.library:GetXmlNodeById($websiteOneHeaderNodeId)" />
<!-- display the banner for website one -->
<img src="{$websiteOneHeaderNode/banner}" />
</xsl:when>
<xsl:when test="$domainName = www.websitetwo.com ">
<!-- get the node for website two -->
<xsl:variable name="websiteTwoHeaderNodeId" select="1002" />
<xsl:variable name="websiteTwoHeaderNode" select="umbraco.library:GetXmlNodeById($websiteTwoHeaderNodeId)" />
<!-- display the banner for website two -->
<img src="{$websiteTwoHeaderNode/banner}" />
</xsl:when>
<xsl:otherwise>
<!-- display the default banner -->
<img src="/media/1001/defaultBanner.jpg" />
</xsl:otherwise>
</xsl:choose>
<>> 如果这些地点使用同样的模板和宏观(方法2):
这是一种比喻更清洁的,利用Umbraco的伟大东西。 d 我建议在文件类型中增加一个财产,代表每个地点的根本节点。 请允许我指出,该文件的种类是Site
,而财产事项是banner。 Url
。 然后,你可以向每一条<代码>Site中的内容节点上载另一条旗帜,然后在XSLT中查阅。 视用户目前对哪一页的看法而定,即使有不同文件类型的分页(并假定有你的宏观),以下的SLT将找到适当的<代码>bannerUrl<>/code>取决于哪一个编码<>Site?
XSLT:
<xsl:value-of select="$currentPage/ancestor-or-self::Site/bannerUrl" />
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...