Home
TeamSite
ASPNET runat calls in tpls
kevinstewart
Has anyone has success using templatedata tpls to generate ASPNET files? This is my first attempt with ASPNET templating. I've taken an existing finished .aspx file and attempted to use it as my form template. From that original, I took the following Declarations syntax:
<%@ Page Language="C#" %>
<%@ Register tagprefix="cp" tagname="header" src="../include/controls/header.ascx" %>
<%@ Register tagprefix="cp" tagname="sidenav" src="../include/controls/sidenav.ascx" %>
<%@ Register tagprefix="cp" tagname="footer" src="../include/controls/footer.ascx" %>
<%@ Register tagprefix="cp" tagname="img" src="../include/controls/img.ascx" %>
<!--#include file="../include/controls/language.ascx"-->
<cp:sidenav runat="server" id="sidenav"
banner="/images/banner.jpg"
banneralt="alt text"
>
<!--#include file="leftnav_tips.aspx"-->
</cp:sidenav>
In my tpl, to ensure that these dclarations are written to the generated file, and not parsed immediately by the server, I use <iw_perl> iwpt_output calls to have the following written to the generated page:
<%
<iw_perl>
iwpt_output("@ Page Language=\"C#\"");
iwpt_output("\n");
</iw_perl>
%>
<%
<iw_perl>
iwpt_output("<%@ Register tagprefix=\"cp\" tagname=\"header\" src=\"../include/controls/header.ascx\" ");
iwpt_output("\n");
</iw_perl>
%>
<%
<iw_perl>
iwpt_output("@ Register tagprefix=\"cp\" tagname=\"sidenav\" src=\"../include/controls/sidenav.ascx\" ");
iwpt_output("\n");
</iw_perl>
%>
<%
<iw_perl>
iwpt_output("@ Register tagprefix=\"cp\" tagname=\"footer\" src=\"../include/controls/footer.ascx\" ");
iwpt_output("\n");
</iw_perl>
%>
<%
<iw_perl>
iwpt_output("@ Register tagprefix=\"cp\" tagname=\"img\" src=\"../include/controls/img.ascx\" ");
iwpt_output("\n");
</iw_perl>
%>
<iw_perl>
iwpt_output("<!--#include file=\"../include/controls/language.ascx\"--> ");
iwpt_output("\n");
</iw_perl>
<iw_perl>
iwpt_output("<cp:sidenav runat=\"server\" ");
iwpt_output("\n");
iwpt_output("banner=\"path\"\n"");
iwpt_output("banneralt=\"alt text\"\n"");
>
<iw_if expr='{iw_value name="dcr.LeftNav"/} ne ""'>
<iw_then>
<iw_include file="{iw_value name='dcr.LeftNav'/}" />
</iw_then>
</iw_if>
iwpt_output("</cp:sidenav>"\n");
</iw_perl>
__________________________________________________
However, the runat call is been run/parsed by the server when the file is being regenerated, and not just written to the regenerated page.
Does anyone have a solution for this? Or even an example of cleaner code to write the ASPNET declarations to the page? Any help would be appreciated.
Thanks
Kevin
Find more posts tagged with
Comments
Migrateduser
Kevin, in our company we are outputting Interwoven content as .HTMLX files and the aspx page reads this HTMLX file to render the page. ASPX page is a class that has to be part of a project compiled and deployed to the web server how do you plan on achieving this?
kevinstewart
boni,
This is our first experience with ASP.NET in the TeamSite environment. I haven't had a lot of luck in either the Support site nor here in DevNet in regards to finding a lot of information about the entire ASP.NET managing and deployment scenerios through TeamSite and OpenDeploy.
I'm afraid I don't understand your sequence of events in regards to what is in the tpl, what type of file is generated from the tpl, and how does that file get further rendered by the final aspx file.
Can you send me an example of what you've done.
Kevin
Migrateduser
Kevin,
Our page is laid out as interwoven content surrounded by a c-clamp. The c-clamp contains left-nav, header (logo, search button, top nav, & bread-crumb), right nav. The aspx page is developed and deployed by a different development life-cycle. The aspx page pulls the htmlx page that was deployed into the webserver by Interwoven OD.
Content life-cycle: User enters content in interwoven DCT and starts a workflow. Workflow generates HTMLX file places this file in a folder outside the templatedata folder and open deploys the generated htmlx file. The navigation and the content relation ship is stored in the database. That is how we display different content. We have set it up this way because our content is very dynamic. We make about 250 open deployments on an average per day.
kevinstewart
Boni,
I'm been trying to catch up on some HTMLX background before getting back to this. Not completely sure I understand a few things:
1) what extension is the file generated through the formspublisher?
2) if it's not an aspx extension, how does the aspx file get created?
3) Is your different development-lifecycle for the aspx file outside TeamSite?
3) Is all of the c-clamp content saved as an htmlx file, and just written as an include file through the tpl?
Can you provide an example of what the tpl looks like?
Kevin
Migrateduser
Kevin,
The file generated using teamsite has a .htmlx extension. htmlx files are well formed html files, well formed in an XML sense.
The relationship (left nav, right nav, bread crumb) is stored in the database. We build an XML file for left nav and bread crumb out of the information stored in the database and this XML file gets updated twice daily.
Say you have product, business, help high level directories. Each of them in our site has a default.aspx page that gets information from the left nav XML, you could also get it from the database directly, get the content (IW content) from the htmlx and renders the page. We render different content using name value pairs in the query string.
The answer to you question is: No we do not build all the page content in a htmlx file. It all comes together when the page is rendered thro the aspx code. Depending upon the size of your site, frequency of content updates you can make design architectural decisions. We had Interwoven consultants come in and help us out with some of our decisions.
kevinstewart
boni,
Thanks.
If the file being generated using teamsite has an htmlx extension, how does that become an aspx file. If my authors need to create file_b.aspx, file_c.aspx and update file_a.aspx, how do they get the template generated this_is_file_b_content.htmlx to be read as file_b.aspx. I can't seem to get the missing step between the generated .htmlx file and the final aspx file, where everything comes together. Is there a step where they need to create the file_b.aspx and from within that file call the contents of the this_is_file_b_content.htmlx.
I've been trying to get this ASP.NET templating ability resolved, with the help from Interwoven Support, for days now. Any possibility of seeing your htmlx tpl file, and also can you show how that final aspx file is created, named, populated with the new content? I understand the concept, but am really having trouble putting it all together, so that a content author who has no programming skills can create the final content by only having to access the FormsPublisher DCR.
Thanks for your help, and definitely thanks for your patience. I'm just amazed that this awesome Devnet forum has had no other members who have ever attempted to use the FormsPublisher before and were successful.
Kevin
Migrateduser
We are using ascx controls in our dot net websites. In our tpl we some thig like this for directive declarations.
<%iw_perl%>
my $controlValue= "<%@ Control %>";
<%/iw_perl%>
Then output the value to generated page like this
<iw_value name= '$controlValue' />
Hope this helps.
Thanks,
Krishna.
Anip
Hello,
We've successfully used TeamSite to template .aspx files. I'm not sure I understand all of the earlier discussion but I wanted to add my tuppence worth in the hope I could help someone on the aspects we've overcome and I might then also get some feedback on my own issues.
We use forms templating as you would normally to generate html files but we generate to files with an .aspx extension. The template contains a reference to a single assembly which contains the codebehind for the entire site. This is because the navigation and breadcrumb are dynamically created from xml (also template generated) and there are other aspects of the site that require .net as they use a third party .net api which gets referenced on page_load. On the template itself there are user controls as well as aspx label controls to which the navigation and breadcrumb are written.
We've had a few teething problems. We had difficulty with the web.config and the configuration hierarchy in TeamSite. We found that TeamSite ignored the web.configs of child applications and everything had to be in the root version. We also found that the lengths you have to go to to configure applications and aspnet_client virtual directories in IIS each time you want to look at an edition is a bit of a challenge.
We just have user control directives within the tpl as you would a normal aspx file. The problem we have is that we found we couldn't use absolute references to the controls,
<%@ Register TagPrefix="dcs" TagName="header" src="/_interface/controls/header.ascx" %>
we could only use relative ones
<%@ Register TagPrefix="dcs" TagName="header" src="../../_interface/controls/header.ascx" %>
which again isn't ideal as although we try to control where the user is going to generate their files to there's not much to stop them creating a nest of directories resulting in the relative path being different for different files generated from the same template.
When the exact same files are served outside of TeamSite they render without problem so it's only in TeamSite environment they have issues. Do I need to set up some kind of remap even though it's a pretty straight site, all coming from the root?
cheers
Ani
JonathonG
You've pretty succintly stated the issues with .NET and TeamSite as we've experienced them as well. Unfortunately, AFAIK, there is no simple solution to them. One pointer I can offer. For the relative paths, we actually used some logic in the template to determine the number of levels of relative pathing we needed to get back to the root. Basically, you know that your _interface directory is at the root of your workarea. You can use iwpt_get_ofile_name to get the path for the generated page. Then, just determine how deep the generated page is and insert the appropriate number of "../"s. Of course, this requires a small bit of programming in Perl, and is a less than desirable solution. But its the only solution I'm aware of.
Jonathon
Interwoven Developer
Allstate, Inc.