I am setting up Umbraco for the first time, and am looking for a way to make use of an #include sort of server call, but I need the included document to run on XSLT. Is there a way in Umbraco to include a file into multiple templates?
The content of the included file will be header information - CSS, JavaScript, and some HTML, and a second file to include footer information and the end </html>. Since this included content will have navigation elements, I need to be able to generate some of this content from XSLT.
If I were not using a CMS, I would create pages for this purpose and reference them with <!-- #include virtual = "include_file.asp" -->, but I'm not sure how to go about this in Umbraco. (I have a feeling the #include virtual method isn't even valid in ASP.NET anyway.)
Based on your comments, it sounds like you might not be familiar with the master page structure in ASP.NET, which is also supported in umbraco. If that is the case, you might want to read this first: http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx.
In umbraco, you would most likely create the master page and on it you would then reference a macro that would call the navigation XSLT. For example:
Then the XSLT would contain the code to parse the content tree to output the navigation elements (as an unordered list most likely).
Now- I realize I did not directly answer your question, so I apologize if you knew all that already, but it just sounds like you are approaching this from a classic ASP perspective.
I think I found the answer to my own question. I created an XSLT file with the CSS, JS, and HTML content in it, then inserted the associated macro into the template, and it works.
#include virtual in Umbraco
I am setting up Umbraco for the first time, and am looking for a way to make use of an #include sort of server call, but I need the included document to run on XSLT. Is there a way in Umbraco to include a file into multiple templates?
The content of the included file will be header information - CSS, JavaScript, and some HTML, and a second file to include footer information and the end </html>. Since this included content will have navigation elements, I need to be able to generate some of this content from XSLT.
If I were not using a CMS, I would create pages for this purpose and reference them with <!-- #include virtual = "include_file.asp" -->, but I'm not sure how to go about this in Umbraco. (I have a feeling the #include virtual method isn't even valid in ASP.NET anyway.)
Thank-you for your help.
Based on your comments, it sounds like you might not be familiar with the master page structure in ASP.NET, which is also supported in umbraco. If that is the case, you might want to read this first: http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx.
In umbraco, you would most likely create the master page and on it you would then reference a macro that would call the navigation XSLT. For example:
<div id="navigation">
<umbraco:Macro ID="Macro1" Alias="Navigation" runat="server"></umbraco:Macro>
</div>
Then the XSLT would contain the code to parse the content tree to output the navigation elements (as an unordered list most likely).
Now- I realize I did not directly answer your question, so I apologize if you knew all that already, but it just sounds like you are approaching this from a classic ASP perspective.
Brad
I think I found the answer to my own question. I created an XSLT file with the CSS, JS, and HTML content in it, then inserted the associated macro into the template, and it works.
is working on a reply...