I hit my first bump today where in customizing the menu structure I found that I can't utilize the <!–– #include virtual/file="file.ascx" ––> option which would be useful for so many things.
Here's the journey I took today in resolving my issue.
After searching the web tirelessly I came across a couple articles that gave me some good not so technical ideas. The one that struck me the most was to utilize DVWP or Data View Web Parts and more specifically the "XML Web Part".
My include file only contained HTML and Javascript this would make it easy to include as the XML Web Part.
How to Build a server side include using the XML Web Part:
- In Sharepoint Designer create your include file and save it as a type
.xml. - Open <Filename>.xml and wrap the source code in the following;<?xml version="1.0" encoding="utf-8"?>
<HTML><![CDATA[
YOUR SOURCE CODE HERE
</HTML> - Save/Close the file.
- In your Masterpage (usually default.master) insert the XML Web Part where you want the include content to appear.
- In the Web Part Properties set:XML Link = <Path>/<Filename>.xml
Appearance
Chrome Type = None - Save/Close your master file and you now have an include for basic HTML and Javascript.
I know for advance ASPX/XML developers this is childs play, but speaking from a classic ASP developers point of view this helps our types with oneof the many transition we need to go through. Enjoy, I hope this helps somebody.
can this work in a page layout other than a master page?
ReplyDeleteThis should work in any of the server side files. Lately, I wouldn't recommend this as there new web part options that should give the same results.
Delete