Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspdotnet_website_programming thread: Moving to providing Dynamic Web Content and Controls using XML


Message #1 by Julian Voelcker <asp@t...> on Fri, 20 Dec 2002 11:24:47 GMT
Hi,

I am about to re-write the front end of a site that I have developed 
and am thinking of changing the way the pages are built up.

At the moment I have a template page that is made up of a mix of user 
controls (for headers and footers, etc) and server controls (for 
delivering the menu and main content) that is used to display around 
1000 pages from data stored in a SQL 2K database.

I then have a few 'special case' pages that are either forms (e.g. 
Contact Us forms) or a mix of content/forms like the home page that has 
a newsletter subscription form (user control) combined with the content 
(e.g. The home page).

You can see the site at http://www.charityskills.org

One of the problems I have is that I now want to be able to dynamically 
change the style sheets that are being used as well as other header 
based info - I basically need to be able to create all the html used 
for the page dynamically.

I am sure that I can remember reading somewhere that it was possible to 
use an XML/XSLT template combination for defining the page structure (
html+User Controls+Server Controls) and then dynamically build the page 
when it is requested.  The model could then be extended to deliver the 
content in different formats for different target devices.

Have any of you come across any articles/samples showing this in 
action?

Any pointers with this would be greatly appreciated.

Cheers,

Julian Voelcker


Message #2 by "Mike Gale" <info@d...> on Mon, 23 Dec 2002 08:19:19 +1300
Julian Voelcker wrote:
> I am about to re-write the front end of a site that I have developed
> and am thinking of changing the way the pages are built up.
> 
> At the moment I have a template page that is made up of a mix of user
> controls (for headers and footers, etc) and server controls (for
> delivering the menu and main content) that is used to display around
> 1000 pages from data stored in a SQL 2K database.
> 
> I am sure that I can remember reading somewhere that it was possible
> to use an XML/XSLT template combination for defining the page
> structure ( html+User Controls+Server Controls) and then dynamically
> build the page when it is requested.  The model could then be
> extended to deliver the content in different formats for different
> target devices.

This is a big area and ideally you need to take some time figuring out
the options.

There are a LOT of approaches out there.  I recommend getting really
familiar with the event cycle in an ASPX page, HTTP handlers etc.  The
published analyses that I've seen ALL leave out some approaches.

For flat content or "traditional HTML/XHTML" the XML control is good.
Otherwise rendering ASPX server side controls gives you headaches in
wiring up the controls to code behind (like on each postback!!).

(Subclassing may be useful.)

A random selection of links follows (no guarantee they still work!).  (I
recommend a Google search or similar, material is popping up regularly.)

http://asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=4692

http://www.asptoday.com/content.asp?id=2025

http://www.fawcette.com/vsm/2002_12/magazine/features/anderson/default_p
f.asp

At present I say stick with the MS approach wherever you can (there are
rumours we may get some similar open source implementations sometime,
don't hold your breath) and if you need to go beyond roll your own for
your special circumstances (but research first).

Mike Gale, Decision Engineering (NZ) Ltd.

CAUTION - This message may contain privileged and confidential
information intended only for the use of the addressee/s. 

If you are not the intended recipient of this message you are hereby
notified that any use, dissemination, distribution or reproduction of
this message is prohibited without prior written consent.  Any views
expressed in this message may not reflect the views of Decision
Engineering.    




Message #3 by Julian Voelcker <asp@t...> on Mon, 23 Dec 2002 12:05:14 GMT
Hi Mike,

Many thanks for the feedback.

Since posting the original message I have found the original article on XML/XLT templates 
and am not sure how relevant it will be for me.

I think that I will avoid any new approaches for the time being - most references seem to 
relate to separating the design from the code, but I need to do too many changes to the 
final page layout (and I do the design anyway)that it makes it a bit impractical.

The route I have used for one site is to have a server control that renders the html and 
then has properties for each of the main elements like Keywords, Description, stylesheet(s
), menu, content, etc.

I then call the control in a blank webform and set the properties values in the code 
behind, the control then response.writes the html. The keywords, description, content, etc 
come from a single database lookup, then elements like the menu, footer, etc are provided 
by other controls because they are dependant on more sophisticated queries.

The site design is based on XHTML/CSS, but has the added complexity of being re-styled 
based on the Users' role as well as their Accessibility settings - I do like to make life 
easy for myself!!

I think that I will leave the actual form side of things alone for the time being.


On Mon, 23 Dec 2002 08:19:19 +1300, Mike Gale wrote:
> This is a big area and ideally you need to take some time figuring out
> the options.
> 
> There are a LOT of approaches out there.  I recommend getting really
> familiar with the event cycle in an ASPX page, HTTP handlers etc.  The
> published analyses that I've seen ALL leave out some approaches.
> 
> For flat content or "traditional HTML/XHTML" the XML control is good.
> Otherwise rendering ASPX server side controls gives you headaches in
> wiring up the controls to code behind (like on each postback!!).
> 
> (Subclassing may be useful.)
> 
> A random selection of links follows (no guarantee they still work!).  (I
> recommend a Google search or similar, material is popping up regularly.)
> 
> http://asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=4692
> 
> http://www.asptoday.com/content.asp?id=2025
> 
> http://www.fawcette.com/vsm/2002_12/magazine/features/anderson/default_p
> f.asp
> 
> At present I say stick with the MS approach wherever you can (there are
> rumours we may get some similar open source implementations sometime,
> don't hold your breath) and if you need to go beyond roll your own for
> your special circumstances (but research first).
>


Cheers,

Julian Voelcker



  Return to Index