Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Header Includes Problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Header Includes Problem

 Post Reply Post Reply
Author
twooly View Drop Down
Groupie
Groupie


Joined: 24 September 2003
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote twooly Quote  Post ReplyReply Direct Link To This Post Topic: Header Includes Problem
    Posted: 11 November 2003 at 7:34am

Ok I am trying to clean up my code now that I have things working ok.  Basicly I am trying to get the html formating out to one include file that way you only have to change one file to change the look.  But for some reason it won't include the file.  Here is my code

If userAdmin = 1 then
<!--#include file='adminheader.inc'-->
Else
<!--#include file='header.inc'-->
End If

 

But if I put the contents of each include into their area then it works.  Anyone have ideas why it doesn't work?

 

Works this way

If userAdmin = 1 then
Response.Write ("<table align='right'><tr><td><a href='main.asp'><img src='images/home2_324.gif' alt='Home' border='0'></a></td><td><a href='profile.asp?mode=view'><img src='images/search_16.gif' alt='View Profile' border='0'></a></td><td><a href='profile.asp?mode=edit'><img src='images/save_16.gif' alt='Edit Profile' border='0'></a></td><td><a href='profile.asp?mode=password'><img src='images/security.gif' alt='Change Password' border='0'></a></td><td><a href='logout.asp'><img src='images/Log-Off_324.gif' alt='Logoff' border='0'></a></td></tr><tr>< td><a href='admin.asp?mode=options'><img src='images/options.gif' alt='Options' border='0'></a></td><td><a href='admin.asp?mode=add'><img src='images/add_account.gif' alt='Add Account' border='0'></a></td><td><a href='admin.asp?mode=admin'><img src='images/add_admin.gif' alt='Add Admin' border='0'></a></td><td><a href='admin.asp?mode=listusers'><img src='images/editaccounts.gif' alt='Edit Accounts' border='0'></a></td><td><a href='admin.asp?mode=reports'><img src='images/reports.gif' alt='Reports' border='0'></a></td></tr></table> <br><br><br><br>")
Else
Response.Write ("<table align='right'><tr><td><a href='main.asp'><img src='images/home2_324.gif' alt='Home' border='0'></a></td><td><a href='profile.asp?mode=view'><img src='images/search_16.gif' alt='View Profile' border='0'></a></td><td><a href='profile.asp?mode=edit'><img src='images/save_16.gif' alt='Edit Profile' border='0'></a></td><td><a href='profile.asp?mode=password'><img src='images/security.gif' alt='Change Password' border='0'></a></td><td><a href='logout.asp'><img src='images/Log-Off_324.gif' alt='Logoff' border='0'></a></td></tr></table> <br><br><br><br>")
End If

Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2003 at 7:47am
<% If userAdmin = 1 then %>
<!--#include file='adminheader.inc'-->
<% Else %>
<!--#include file='header.inc'-->
<% End If %>

The newest versions of ASP disables the ability to do includes within a code block.
Back to Top
twooly View Drop Down
Groupie
Groupie


Joined: 24 September 2003
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote twooly Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2003 at 7:54am

Worked like a charm.  I guess that is why I am a newbie.  Thanks for the help.

 

--Todd

Back to Top
twooly View Drop Down
Groupie
Groupie


Joined: 24 September 2003
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote twooly Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2003 at 8:08am

Ok along those same lines how can I include DB information?

<%

ASP code here

<!--#include file='dbconnection.inc'--> ??????????

ASP code here

%>

contents of dbconnection.inc

Dim adoCon         'Holds the Database Connection Object

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("site.mdb")

Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2003 at 8:13am
in the same manner
<%

ASP code here

%>
<!--#include file='dbconnection.inc'-->
<%

ASP code here

%>
Back to Top
twooly View Drop Down
Groupie
Groupie


Joined: 24 September 2003
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote twooly Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2003 at 9:00am
Here is the problem.  I tried that and when I do that it basicly just prints out the contents of the file.  I just want the file used for the information inside of it not print it.  (Contains DB Conntection information)
Back to Top
twooly View Drop Down
Groupie
Groupie


Joined: 24 September 2003
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote twooly Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2003 at 9:06am
Nevermind got it figured out.  I didn't have <% %> in my include file
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.