creating a skinnable website

Torro

Member
Aug 14, 2002
163
0
0
not sure if this is the right forum
plz redirect as necessary

i am trying to create a skinnable website using asp but i am having problems with the script that is supposed to load the appropriate header/footer files

does anyone know any good articles or could help me personally?

piece of script that doesnt work thus far
in my index file i load the footer asp as such

**********
< !-- include virtual="/skins/getfooter.asp" -->
***********

getfooter.asp contains the following
***********
<% string skin = Session.Contents["skin"];
if (skin == "default") %>
< !-- include virtual="/skins/defalt/footer.inc" -->
<% if (skin == "reverse") %>
< !-- include virtual="/skins/reverse/footer.inc" -->
etc
************


any help will be appreciated
thanks
this should load the appropriate file but instead it loads all of them
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
Your IF statements don't have a THEN portion...

<% string skin = Session.Contents["skin"];
if (skin == "default") THEN %>
< !-- include virtual="/skins/defalt/footer.inc" -->
<%Else if (skin == "reverse") THEN %>
< !-- include virtual="/skins/reverse/footer.inc" -->

Or perhaps make use of Select/Case...
 

Torro

Member
Aug 14, 2002
163
0
0
tried that and got an aspxerrorpath error
i also have asp.net on my machine and the files are aspx files
could that be causing the problem
***
<%
string skin = Session.Contents["skin"].ToString();
if (skin == "default") Then %>
< !-- #INCLUDE virtual='/skins/default/footer.inc' -->
<% else if (skin == "reverse") %>
< !-- #INCLUDE virtual='/skins/reverse/footer.inc' -->
<% else if (skin == "mouse") %>
< !-- #INCLUDE virtual='/skins/mouse/footer.inc' -->

****

edit:
if i open the site on my machine i can see the actual error

**Compiler Error Message: CS1002: ; expected** on the skin == default line
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
ahh... are you doing it in C# then? I assumed it was ASP and VBScript was being used.
 

Torro

Member
Aug 14, 2002
163
0
0
its in C#
should have mentioned that earlier
is there a way to place vbscript somewhere in there even though i defined everything as being c#?
if not, how should i edit the current if statements?
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
Originally posted by: Torro
its in C#
should have mentioned that earlier
is there a way to place vbscript somewhere in there even though i defined everything as being c#?
if not, how should i edit the current if statements?

Umm... according to your original post, you say that your file is a .asp... C# is only in Asp.Net.
 

Torro

Member
Aug 14, 2002
163
0
0
i changed all my file extensions to aspx so i could use asp.net and C#
but i thought if i used the <% %> delimiters it would reference inside this as normal asp?
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
ahh... then you don't need the Then on that line... that's a VBScript thing.
 

Torro

Member
Aug 14, 2002
163
0
0
hmmm could it be the content of the includes causing it to mess up then?

tried it but i took out the content of include for the reverses directory and that file did not show up
how weird is that?
gonna poke around in it more to see which line is causing the problem

edit: the footer files have the following text
<%
foreach(char x in page)
Response.Write(x.ToString().ToUpper() + " ");
%>
if i take this out of the footer files then it proceeds as expected and only shows 1 of the footers as chosen bythe if statements
if i leave this in the footer file, then the entire footerfile is displayed despite the if statements
any one knows why this is the case?
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
You need braces in your statements too...

if (blah) {

} elseif (blah) {

} else {

}
 

Torro

Member
Aug 14, 2002
163
0
0
the braces worked !!!
thanks alot
do you know where i could read up more on this kinda stuff?
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
Best website for introductory asp.net is http://www.asp.net.

Do you have any programming experience at all? If not I would reccomend purchasing a beginners programming book. Every C# book I've seen assumes you know some programming... depending how how good of a learner you are you can simply google C# for lots of articles on it. I know Java so C# came pretty easy for me.

 

Torro

Member
Aug 14, 2002
163
0
0
i have c# programming experience
i just assumed that since i had 1 statement for each if i wouldn't need braces