M
Mark
I am setting up an asp.net site using the Ektron CMS. Every page in the
site uses the same basic template, with the look of the page changing
via CSS and an id on the body. The id is shared by all pages in a
subsection, e.g. everything in /about/ needs to have <body id="about">.
In the past what I've done is set a global variable in index.asp, then
include the template to render the page:
<%
pageid = "about"
defaultcontentid = 33
%>
<!--#include virtual="/include/mastertemplate.asp" -->
mastertemplate.asp would be the entire page, echoing and processing the
variables like so:
<!--#include virtual="/include/cmsfunctions.asp" -->
<body id="<%= pageid %>">
<%= cmsRenderContent(defaultcontentid) %>
This worked great. I needed one index.asp for each subsection, and had
no duplication of template code. If the template needed to be updated, I
just gave it to the designer, who modified it in Dreamweaver or
whatever. The separation between presentation and logic was good, and
any code that generated html was in an easily-modified function.
I've experimented with a similar approach in asp.net, and have the start
of it working, but the additional complication is that
mastertemplate.aspx has some codebehind related to the cms server
controls that it uses, and I need to use the passed-in variables within
that codebehind. For example, I'd establish a default content id in the
calling page, and if the mastertemplate.asp doesn't detect an id in the
url, it will use the default.
I am looking for examples of this approach in asp.net but I keep running
across advice to use user controls instead. But it seems like user
controls are used for parts of pages, not the page template itself. Is
that right? Can a user control contain server controls? How would I pass
variables from a "stub" calling page to the user control page? Can a
user control be modified in something like Dreamweaver?
Thanks,
site uses the same basic template, with the look of the page changing
via CSS and an id on the body. The id is shared by all pages in a
subsection, e.g. everything in /about/ needs to have <body id="about">.
In the past what I've done is set a global variable in index.asp, then
include the template to render the page:
<%
pageid = "about"
defaultcontentid = 33
%>
<!--#include virtual="/include/mastertemplate.asp" -->
mastertemplate.asp would be the entire page, echoing and processing the
variables like so:
<!--#include virtual="/include/cmsfunctions.asp" -->
<body id="<%= pageid %>">
<%= cmsRenderContent(defaultcontentid) %>
This worked great. I needed one index.asp for each subsection, and had
no duplication of template code. If the template needed to be updated, I
just gave it to the designer, who modified it in Dreamweaver or
whatever. The separation between presentation and logic was good, and
any code that generated html was in an easily-modified function.
I've experimented with a similar approach in asp.net, and have the start
of it working, but the additional complication is that
mastertemplate.aspx has some codebehind related to the cms server
controls that it uses, and I need to use the passed-in variables within
that codebehind. For example, I'd establish a default content id in the
calling page, and if the mastertemplate.asp doesn't detect an id in the
url, it will use the default.
I am looking for examples of this approach in asp.net but I keep running
across advice to use user controls instead. But it seems like user
controls are used for parts of pages, not the page template itself. Is
that right? Can a user control contain server controls? How would I pass
variables from a "stub" calling page to the user control page? Can a
user control be modified in something like Dreamweaver?
Thanks,