Click to See Complete Forum and Search --> : Page Templates?
lmf232s
12-06-2005, 11:19 PM
Well,
I finally got around to building my site in .net and 1 of my first questions is are the include files. I understand that they are no longer supported and there are other ways of accomplishing this. My question is what should i use.
Im not looking to do anything fancy in the include files. I just need a header and a footer.
I read a few articles on creating usable page templates but they are pretty indepth and im not sure im looking for that much complexity when i do my include. But if this is the proper method and allows for flexiblilty down the road, then maybe this is something i should do.
Here is the article i looked at
http://www.devx.com/dotnet/Article/18011
Let me know if this is the way to achieve what im looking for.
I have access to a site that was done in asp.net and it has a TemplateMaker directory that has a couple classes in it, that call a Templates directory that has the actual aspx pages. I was going to revers engineer this but it seem to have more complexity than what im looking for.
So whats your advice?
Cipher
12-07-2005, 06:03 AM
What you need is "UserControls", UserControls is just like include files, it allow you to create anything in it, and use it in many pages, check this out (http://www.webdeveloper.com/forum/showpost.php?p=457546&postcount=2)
lmf232s
12-07-2005, 09:30 AM
Cipher,
I like that. Very simple and not at all complicated like the page templates i was looking at. I will have to give this a shot tonight and see how it goes.
I more thing on this situation as i cant try it at the moment. In asp i had include files that held common functions and subs and all my DB stuff.
Can i use this same technique for this type of a situation?
In the example i looked at, where you want the include file displayed you used a tag but for something like and include for functions you would not use a tag on the aspx page but you would need it on the vb page.
How would i go about this 1?
Thats it,
Larryf
lmf232s
12-08-2005, 12:49 AM
Alright i got these includes up and running but i have another question about what i should put in the Header user control.
I wanted to put this code in the file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title></title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK rel="stylesheet" type="text/css" href="/Styles.css">
</HEAD>
<body>
But to include the header file you have to place the Include tag inside the form tag
<form id="Form1" method="post" runat="server">
<!--Header Include-->
<HeadInc:Header runat="server" ID="Header1"/>
It wont let me do this
<!--Header Include-->
<HeadInc:Header runat="server" ID="Header1"/>
<form id="Form1" method="post" runat="server">
But by doing this i am actually placing all <head><body><html> tags inside the <form> instead of on the outside of the <form>.
I can do it and it works, but will this cause problems down the road?
Let me know what you think about this.
lmf232s
12-08-2005, 12:52 AM
Never mind, i just looked at the source of the page and it all displays correclty.
Still alittle confussing. I would of thought the header information would of displayed inside the <form> tag.
sirpelidor
12-08-2005, 02:04 AM
Still alittle confussing. I would of thought the header information would of displayed inside the <form> tag.
header, footer:
http://www.webdeveloper.com/forum/showthread.php?t=84033
menu:
http://www.webdeveloper.com/forum/showthread.php?t=85401
has to respond to wanted to use a "common function" share among diff aspx pages:
just do what would've done with Object Oriented Programming, go ahead and make yourself some objects, and access methods from it.
Cipher
12-08-2005, 06:19 AM
Alright i got these includes up and running but i have another question about what i should put in the Header user control.
I wanted to put this code in the file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title></title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK rel="stylesheet" type="text/css" href="/Styles.css">
</HEAD>
<body>
Well i'm sorry for not responding, but i think when you use this header in the original page, it will work also for the header.