Reading in URL prameters Options
Zach
Posted: Monday, September 17, 2007 6:44:46 PM
Rank: Devotee

Joined: 8/15/2007
Posts: 30
I'm going to try to modify the source so that Umbraco grabs URL or post parameters and puts them into a node on the XML tree dynamically. First of all, before I get started, is this even possible? :hmm: If it is possible, can anyone give me a hint as to where in the source code would be a good starting point?

Thanks!
Zac
mortenbock
Posted: Monday, September 17, 2007 8:59:07 PM

Rank: Addict

Joined: 7/19/2006
Posts: 818
Location: Århus, Denmark
Just to understand the question right, what do you need the url/post parameters in the xml for? I can't quite imagine a scenario where it is useful, since i guess that the url/post parameters are not specific to one node?

Can you explain the scenario?

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

Zach
Posted: Monday, September 17, 2007 11:02:05 PM
Rank: Devotee

Joined: 8/15/2007
Posts: 30
I want to pass a parameter on the url to be able to bypass the normal visual style and spit out the Umbraco XML in a different XML format. The new XML format will be read in by a Windows desktop based application and stored stored client side for offline use. I'm very new to Umbraco and after looking around a little, this seems to be the only way to do it. I'm I making this more difficult than it should be?
mortenbock
Posted: Tuesday, September 18, 2007 7:40:31 AM

Rank: Addict

Joined: 7/19/2006
Posts: 818
Location: Århus, Denmark
So if you go to

www.yourdomian.com/my-page.aspx?output=xml

You need to get some xml about that specific page? Or do you want the entire xml tree when visiting

www.yourdomian.com/?output=xml

Either way, this should be possible to do with xslt. Actually, that is what xslt is for, so I would definaetely start with that approach.

Umbraco has a neat feature called "Alternative templates". This means that you can use a querystring parameter to choose another template to use for rendering the page:

www.yourdomian.com/my-page.aspx (Renders the normal page)
www.yourdomian.com/my-page.aspx?altTemplate=xml (Renders the page with the template where alias = xml)

On your XML template you can then place an xslt macro that transforms the nodes XML into the xml that you need. Maybe you also need to add a .net macro that changes the MIME type for the response, if your windows app needs the correct header.

Could you give an example of the xml that you would like to output for a node?



Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

Zach
Posted: Tuesday, September 18, 2007 4:51:48 PM
Rank: Devotee

Joined: 8/15/2007
Posts: 30
I had no idea that was there. Basically I'm setting up a site that will associate airports with cities. The Windows application will just do a screen scrape of the node and store it locally. The XML output should look something like:

Code:

<?xml version="1.0" encoding="utf-8" ?>
<AirportInfo>
   <Airport name="San Francisco International Airport" iataCode="SFO">
         <Detail name="Airport Info" abbr="Airport">
           <!-- Detail nodes can contain standard xhtml -->
         </Detail>
         <Detail name="City Info" abbr="City">
         </Detail>
         <Detail name="Local Specials" abbr="Specials">
         </Detail>
         <Detail name="Hotels" abbr="Hotels">
         </Detail>
         <Detail name="Weather" abbr="WX">
         </Detail>
         <AssociatedCities>
           <City name="San Fransisco" role="primary" />
           <City name="San Jose" role="secondary" />
           <City name="Oakland" role="secondary" />
         </AssociatedCities>
   </Airport>
</AirportInfo>


I'll play around with the alternate Style sheet and I sxhould be able to write up an XSL to do the transform pretty easily.

Thanks!
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.