SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb shtml + CSS Question

    Heya,

    I was wondering if it was possible to call up an html (shtml?) file within a table? And is this done with shtml?

    And if so, would the documents CSS also apply to that document?

    Hope you can help,

    thanks!
    Greetz.
    That's all folks...

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can "include" (call a fragment of code using Server Side Includes (shtml)) from aynwhere on your page.

    Yes, any CSS applicable to that page will affect the included fragment as the fragment is merged with the page before the user sees it.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    <C²: web standards /> cybercodeur's Avatar
    Join Date
    Dec 2001
    Location
    Montréal
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Keep i mind that the CSS affects the page it is linked to. Since includes are read on the server side before the page is displayed, they are already part of your web document once it's being read by the browser.

    Therefore, it is part of the page it is included in, just like anything else.

    So the CSS applies to it naturally, wherever it is.

    And yes you can include in a table, just like you can in a div or directly in the body for that matter. You can include everywhere. Even the head of your document could be made into an include if you so wished.
    Denis Boudreau <C²/> - Web Standards & Accessibility
    [+] ICQ number: 115649885 || Email: denis@cybercodeur.net
    [+] Daily Weblog on Web standards and accessibility : CYBERcodeur.net

  4. #4
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is great! (and amazing!).

    Could someone maybe explain how to include this article properly in a table (td).

    Or direct me?

    Thank you very much indeed!

    Greetz.
    That's all folks...

  5. #5
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have Just been doing this and as far as I know, you would do it like this.

    Code:
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><!--#include virtual="fileyouwanttoinclude.txt" --></td>
      </tr>
    </table>
    
    or:
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><!--#include virtual="fileyouwanttoinclude.html" --></td>
      </tr>
    </table>
    The file that calls the Server Side Include (SSI) needs to have the shtml suffix, i.e. page.shtml

    Glen

  6. #6
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glen,

    this is great! Thank you!

    Is there a certain format that the inserted file needs to have? Head or no head, etc?

    Greetz & More Thanks!
    That's all folks...

  7. #7
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want basic HTML to be inserted then just the tags that you want in the text file and the browser will end up with with just one page, so you only need to specify the HEAD etc tags once in the main document.

    I have just saved a code block in a .txt file and done it that way so my txt when opened in notepad looks like:

    Code:
    <td>
    Some random code........
    </td>
    Hope it helps

  8. #8
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright!
    I guess I have to understand that once the file is loaded, the browser views the result as being one page only.

    So I would just put the HTML in the (txt or html)file as if it were part of the page already!?!

    This is great stuff!
    Greetz and no need for hoping glenplake, it DID help!
    That's all folks...

  9. #9
    <C²: web standards /> cybercodeur's Avatar
    Join Date
    Dec 2001
    Location
    Montréal
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Tyhe
    Alright!
    I guess I have to understand that once the file is loaded, the browser views the result as being one page only.

    So I would just put the HTML in the (txt or html)file as if it were part of the page already!?!
    Yep that's exactly it. The browser only sees it as the content of one big page.

    However, I have taken the habit to name my include pages .html, not .txt since they contain HMTL tags. But I think this is only a matter of personal choice.

    You do what you want on that one.

    But yes this is a great plus to your toolkit!
    Denis Boudreau <C²/> - Web Standards & Accessibility
    [+] ICQ number: 115649885 || Email: denis@cybercodeur.net
    [+] Daily Weblog on Web standards and accessibility : CYBERcodeur.net

  10. #10
    Tenacious T Tyhe's Avatar
    Join Date
    May 2001
    Location
    Hilversum
    Posts
    651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And what are the requirements for using such a shtml file?

    That my server supports SSI?

    That's it?

    Greetz!
    That's all folks...

  11. #11
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Tyhe
    And what are the requirements for using such a shtml file?

    That my server supports SSI?

    That's it?

    Greetz!
    Yup!

  12. #12
    <C²: web standards /> cybercodeur's Avatar
    Join Date
    Dec 2001
    Location
    Montréal
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SSIs can be supported by just about any server. It's just a matter of configuration and good-will from the administrator's part.
    Denis Boudreau <C²/> - Web Standards & Accessibility
    [+] ICQ number: 115649885 || Email: denis@cybercodeur.net
    [+] Daily Weblog on Web standards and accessibility : CYBERcodeur.net


Bookmarks

Posting Permissions

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