New way of handling Page Url Rendering 2.1.3?

Topics: General, XSLT
Jul 13, 2011 at 9:54 PM
Edited Jul 13, 2011 at 9:56 PM

I used to insert the following text to render C1 pages in XSLT:

/Renderers/Page.aspx?pageId={GUID}&myQueryString=1897&someotherQuery=4

Typically, this might look like:

<xsl:attribute name="href">
                <xsl:text>/Renderers/Page.aspx?pageId=</xsl:text>
                <xsl:value-of select="/in:inputs/in:param[@name='ProductsPage']" />
                <xsl:text>&amp;c=</xsl:text>
                <xsl:value-of select="id"/></xsl:attribute>
              <xsl:value-of select="name"/>

However, I noticed in the newest UI, it opts instead to render out the Insert Page Links as ~/Page(GUID)

I like this change, however, how do we add query strings or PathInfo to the end of this link? I have tried just appending it to the end but it doesn't seem to resolve if I do that. Is there some documentation as to how the new changes affect Routing of pages etc.?

Developer
Jul 14, 2011 at 7:14 AM
Edited Jul 14, 2011 at 10:31 AM

Hi atomiton

I have just tried your sample with ~/Page({GUID}) instead of /Renderers/Page.aspx?pageId={GUID}. It works OK.

Please see how I changed it:

<xsl:attribute name="href">
  <xsl:text>/Page(</xsl:text>
  <xsl:value-of select="/in:inputs/in:param[@name='ProductsPage']" />
  <xsl:text>)?c=</xsl:text>
  <xsl:value-of select="id"/>
</xsl:attribute>
<xsl:value-of select="name"/>

The link resolves to http://my.web.site/Products?c={id}

/Vitaly

Developer
Jul 14, 2011 at 7:31 AM

You can also use the PathInfo. But you should register its usage first by inserting this function: Composite.Web.Request.RegisterPathInfoUsage

So you can change your sample to this:

<!-- register the PathInfo usage -->
<f:function xmlns:f="http://www.composite.net/ns/function/1.0" name="Composite.Web.Request.RegisterPathInfoUsage" />
...
<!-- generate a link with the PathInfo -->
<xsl:attribute name="href">
  <xsl:text>/Page(</xsl:text>
  <xsl:value-of select="/in:inputs/in:param[@name='ProductsPage']" />
  <xsl:text>)/</xsl:text>
  <xsl:value-of select="id"/>
</xsl:attribute>
<xsl:value-of select="name"/>

You should get:  http://my.web.site/Products/{id}

To query the PathInfo values use of the new functions:

  • Composite.Web.Request.PathInfo
  • Composite.Web.Request.PathInfoGuid
  • Composite.Web.Request.PathInfoInt

You can read on themby generating documentation:

  1. In the Functions perspective, expand "All Functions" > "Composite" > "Web "
  2. Select "Request"
  3. Click "Generate Documentation" on the toolbar
  4. Read it :)

/Vitaly

Jul 14, 2011 at 10:30 PM

Thanks wysocki. I couldn't find this information elsewhere, so I'm sure it will help others.

Developer
Jul 15, 2011 at 7:14 AM
atomiton wrote:

Thanks wysocki. I couldn't find this information elsewhere, so I'm sure it will help others.


We will add this information to our documentation website.

Developer
Jul 18, 2011 at 10:14 AM
wysocki wrote:
atomiton wrote:

Thanks wysocki. I couldn't find this information elsewhere, so I'm sure it will help others.


We will add this information to our documentation website.

http://docs.composite.net/HandlingURLs