Adding Query string based on Meta Data

Topics: General
Jan 15, 2011 at 6:00 PM
Edited Jan 15, 2011 at 6:00 PM

Hi there!

What's the best way to assign a Query String to a page URL based on Meta Data stored together with the page so that it would be added in the navigation?

My scenario is that I have created a page template called Region that I would like to populate a grid/list with data depending on the Query String "region":

E.g. http://my.url.com/pagename.asp?region=1

The Query String should be created instantly when the left hand and top menu is rendered.

Any ideas?

Best Regards Krezz

Jan 16, 2011 at 1:06 AM

I guess you need to use function Composite.Web.Request.QueryStringValue to get the value of a query string.
Check this for more info:
http://docs.composite.net/C1/XSLT/GuideToXsltFunctions.aspx/Making-Function-Calls 

If you want to to be added to menu links then you have to edit the navigator package and add the value.

Jan 16, 2011 at 12:54 PM

Thanks for your answer that I think would be very useful even though I have decided not to use the query string in the menus and instead add it within the content.

Best Regards Krezz

Jan 16, 2011 at 10:13 PM
Edited Jan 16, 2011 at 10:14 PM

Hi there!

Changed strategy and got a bit further but now I am stuck again =(

I have this problem what I want to do is to use Meta Data from the page as the in parameter for a function reading from a MSSQL database. 

I could get tha data from the databaseif I use the fixed value for the parameter regionid tha data turns up very nice.

<f:function name="Omnicorp.SQL.SelOneRegion" xmlns:f="http://www.composite.net/ns/function/1.0">
  <f:param name="regionid" value="1" />
  </f:function>

The other fuinction that I would like to use is to get this to be dynamic, it shows the Meta Data regionid from the page perfectly.

<f:function xmlns:f="http://www.composite.net/ns/function/1.0" name="Omnicorp.SQL.GetPageRegionID" />

Now what I would like to do is to instead of having the fixed value is to get this from the Meta Data for the page (the syntax prevents me from using the function instead of the fixed value)

Any suggestions is very welcome =)

Best Regards Krezz

 

 

 

Jan 17, 2011 at 11:44 AM

I guess this is what you are looking for:

<f:function name="Omnicorp.SQL.SelOneRegion" xmlns:f="http://www.composite.net/ns/function/1.0">
	<f:param name="regionid">
		<f:function name="Omnicorp.SQL.GetPageRegionID" />
	</f:param>
</f:function>

Jan 18, 2011 at 11:57 AM
Edited Jan 18, 2011 at 5:03 PM

Found that the result from my function Omnicorp.SQL.GetPageRegionID either contains the html code (xhtml) or the xml-element name (XML) so I have to find another way to solve this than using the Page Meta Data RegionID.

So I have an idea to instead of using the Page Meta Data to use the Page Id (GUID) so my new question regarding this is if someone has an idea how to get the Page Id without any "additional code" like this 3F2504E0-4F89-11D3-9A0C-0305E82C3301 ?

OR is there a way to get the Current Page Id into a "Input Parameter" when I create the Function in the GUI?

Best Regards Krezz

Problem Solved:

  <f:function name="Omnicorp.SQL.SelOneRegion" xmlns:f="http://www.composite.net/ns/function/1.0">
   <f:param name="strRegionIdGUID">
    <f:function name="Composite.Pages.GetPageId" />
   </f:param>
  </f:function>