www.webdeveloper.com
Results 1 to 15 of 15

Thread: Newbie - Including files?

  1. #1
    Join Date
    Feb 2003
    Posts
    22

    Newbie - Including files?

    I have already layed out my site in html, with the only table that changes in a different file. I was linking to this at the appropriate place using php before. I placed the script between <div> and </div> tags. When I changed my file type to asp so I could use other features, I also changed the script to load the other page. I just included this tag between the <div> and </div> tags instead:

    <!--#include file="default.asp"-->

    The space where this previously worked when using php is now blank using this tag. Am I doing something wrong?

    Also, I have seen some sites using asp have a layout where the address ends in something like: main.asp?id=1. How do I create this kind of layout? What do I need to save each new page as so it can be linked to in this way?

  2. #2
    Join Date
    Nov 2002
    Location
    Norwood, MA
    Posts
    187
    Hi there!

    I use the include tag with my ASP pages and I don't encircle it with the div tag... perhaps getting rid of those might do the trick. Oh! And when you do that type of include, nothing shows up in the browser when you view the source, that's why it's a great place to hide authentication stuff!!

    Also, the ASP layout you talk about are actually queries, where you open a page pulling up info from a record using the criteria that comes after the =? symbols. I use FrontPage to generate those queries.

    I know that didn't answer all your questions, but I tried!!!!!

    Natalia
    Last edited by NatuScape; 02-21-2003 at 12:19 PM.

  3. #3
    Join Date
    Feb 2003
    Posts
    22
    I tried getting rid of the div tags and I still get nothing . Is there something I need to put on the page to be loaded, at the moment it consists of only the required html.

  4. #4
    Join Date
    Nov 2002
    Location
    Norwood, MA
    Posts
    187
    Now that I think of it... all my includes are ALSO asp pages... Perhaps that's why??

    Re-read my original response, cause I just edited it a bit!!

  5. #5
    Join Date
    Feb 2003
    Posts
    22
    All of my pages so far are .asp and, as you can see in my first post, I am including a .asp file called default.asp. I was wondering if I need to use any further script (<% %>) in order to get this to work

  6. #6
    Join Date
    Feb 2003
    Posts
    22
    Here is my current page where the file is not included:

    http://www.mastahuk.com/asp/index.asp

    Compare this to my .php version of the same page, where the file is included:

    http://www.mastahuk.com/

    The file that is included does not change at all except for the filename cahnging from .php to .asp. Could you view script on these pages to see if I am missing something important?

    Thanks alot

  7. #7
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    hi,
    had a look at your ASP page source code and actually seen the line:
    Code:
    <!--#include file="default.asp"-->
    This should not be the case. If i view the source it should just be HTML where the include file is. Now there are a number of reasons why this has happened. Maybe you have the following code:

    Code:
    <%
    <!--#include file="default.asp"-->
    %>
    This would not work.
    An include file doesn't go within <% and %>. Remember you may have more ASP code in your include so you would have <% from your current page then followed my any <% and %> in your include, then you are doing %> back in your current page. This will not work.
    Just try this:
    Code:
    <%
    'whatever asp code here
    %>
    <!--#include file="default.asp"-->
    <%
    'the rest of your asp code
    %>
    Failling that have you tried using virtual inc file?

    Code:
    <!--#include virtual ="default.asp"-->
    If it still isn't working please post the code for the page.

    Hope this helps
    ----------------------------------

  8. #8
    Join Date
    Feb 2003
    Posts
    22
    I cannot understand why this isnt working as it is not any of the problems you just said. I dont even have any script in the entire page within <% %> tags. This is the bit of the script directly above and below the include file tag:

    <td width=440 valign="top" rowspan=200>
    <!--Start of main section-->
    <!--#include file="default.asp"-->
    <td width=30>

    Any more ideas?

  9. #9
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    hi,
    i just posted your code into an asp page and it works fine. This part of your code is correct. I am thinking there must be something else further up in your page that is cascading down and making this not work correctly. Without seen more of your code i couldn't really tell you what it is.
    Maybe it is just an HTML problem, or it maybe an error in the include file itsself.
    ----------------------------------

  10. #10
    Join Date
    Feb 2003
    Posts
    22
    Here is the index file...
    Attached Files Attached Files

  11. #11
    Join Date
    Feb 2003
    Posts
    22
    ...and here is the default file

    Both have been renamed to .txt just so they can be attached here.
    Attached Files Attached Files

  12. #12
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    hi,
    can you post the include file as well. The more i look at this the more i think it is an HTML problem.
    I would however make the page an ASP page as you are loading into the page another ASP page. This would mean that you have an HTML page with an embeded ASP page. Just add this line to the top of your page you posted:

    Code:
    <%@ LANGUAGE="VBSCRIPT" %>
    Try it again and see what happens, i doubt this will fix it but its a start.
    The other thing i am worried about with your code is you have a <TABLE> tag then all your rows and columns extra then you have your include file then more table rows and columns then you close of your </TABLE> tag at the end. Now in Dreamweaver i am getting an HTML error on the first <TABLE> tag. I think this is the problem.

    Hope this helps
    ----------------------------------

  13. #13
    Join Date
    Feb 2003
    Posts
    22
    I dont know what you mean by making this page an asp page, it already is index.asp. You only have the .txt versions because, as I said, it has to be for me to attach it.

    As for there being a html problem, I cant see how because it worked fine before I ever added any scripting. Well thats me confused then!

    Anyway I just discovered from my hosting that they do not even support asp at the moment so unless I get new hosting I will not even be able to do this. I guess I could try php again unless you can give me a valid reason not to.

  14. #14
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    hi,
    ok np, even allthough you have given your index page the extention .asp it is still not an ASP file until you add the following tag to the top of your index page:

    Code:
    <%@ LANGUAGE="VBSCRIPT" %>
    The HTML code error, well Dreamweaver color codes your code for you, just helps the errors to stand out. Dreamweaver colors table tags green, but if there is an error with the tag then it would color it black. When i pasted your code into dreamweaver everything was ok apart from the first table tag which it colored black. This is where i think the error is and would advise you have a look at it.
    Bummer about your host not supporting ASP, but stick with it once you find the error you will be fine.
    ----------------------------------

  15. #15
    Join Date
    Feb 2003
    Posts
    22
    I will definately try to fix this table problem you seem to have found, but I do not see how I can continue with asp for now at least. I dont want to be paying for more hosting and not even using one of my hosts, it is a waste of money (which I aint got). Technical support at my hosting said that this could be done easier and faster in php anyway. I will look into it.

    Thanks anyway for your time and help.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles