Have an XSLT macro output partially in the header, and partially in the content area (GoogleMap)
I'd like to create a single XSLT macro that i can use throughout content area's, to include google maps with lots of pointers (different locations) and different icons.
The issue i'm looking at is that i need the xslt to:
* output javascript in the header * and a div in the content area where i want to display the map
Any advice on how to achive this, if it's possible?
Using a different template would ofcourse also work, but that would limit me as i would have to create a seperate template & document type for each situation where i'd want to use a google map...
You can use umbraco.library:RegisterJavacriptFile (with runat=server on your head tag) to add a stylesheet, but there's usually no need to insert the js in the head of the file as the xslt can simply output javascript in-page with no issues. In fact speed recommendations often point to this as a way to improve speed on page (move script files towards bottom of page).
The div in the content area is the trivial part.
Here's an example of scripts inside xslt, and passing xslt variables to javascript variables.
Have an XSLT macro output partially in the header, and partially in the content area (GoogleMap)
I'd like to create a single XSLT macro that i can use throughout content area's, to include google maps with lots of pointers (different locations) and different icons.
The issue i'm looking at is that i need the xslt to:
* output javascript in the header
* and a div in the content area where i want to display the map
Any advice on how to achive this, if it's possible?
Using a different template would ofcourse also work, but that would limit me as i would have to create a seperate template & document type for each situation where i'd want to use a google map...
Kind regards,
Rik
You can use umbraco.library:RegisterJavacriptFile (with runat=server on your head tag) to add a stylesheet, but there's usually no need to insert the js in the head of the file as the xslt can simply output javascript in-page with no issues. In fact speed recommendations often point to this as a way to improve speed on page (move script files towards bottom of page).
The div in the content area is the trivial part.
Here's an example of scripts inside xslt, and passing xslt variables to javascript variables.
dsa
grmbl... xslt doesn't validate the google map code...
Post your xslt file here and I can take a look. It might be as simple as changing & to &
Here's an off-the-wall thought. Couldn't you create template regions in your master template and then use UCs to populate them on demand?
Just my 2-cents.
Cheers,
Nik
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.