Reply
A piece of code that will include a file in my current directory?
Old 05-16-2006, 03:03 AM A piece of code that will include a file in my current directory?
Experienced Talker

Posts: 33
Hi guys and gals

Heres how it works. Any directory (eg: ../about) has a simple shtml file that
"sucks" a common template (../template) into its directory, using Server Side Includes.

That template contains everything but the content (the template links to the content). Styled html files containing nothing but the content are placed in each directory (../about/content.shtml, ../contact/content.shtml ).

The template is sucked into the needed directory file (from ../template/tem.shtml to ../about/index.shtml) using SSI. The template contains a SSI link to suck the content in its relative directory ( <!--#include virtual="content.shtml" --> ) into itself, thus sucking different content into a common template.

As you can see, this would allow updating of the look for your site a breeze, including where things are placed (css cant position in that way).

The trouble is, everything works, exept as im using SSI, the content.shtml file is sucked up into the template before the template itseld is put in the right directory. Server Side Include's suck the content in to early. I need something that shows the content. Something that performes the same function as a frame, exept acts like a css layer.

I need a solution that will show a file inside a file, without creating any scroll bars, fixed dimensions etc. Something that just "flows". Any other suggestions on this crazy indea are welcome.

Thanks
Maedi
Maedi is offline
Reply With Quote
View Public Profile Visit Maedi's homepage!
 
When You Register, These Ads Go Away!
Old 05-16-2006, 05:44 AM Re: A piece of code that will include a file in my current directory?
chrishirst's Avatar
Super Moderator

Posts: 13,609
Location: Blackpool. UK
Server Side Includes are done as the file is sent out from the server so as templates are done in the design side (assuming you are using some WYSIWYG tool) they aren't put in first.

If you are using DW it maybe that "Show Contents of Included File" is checked in preferences.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-16-2006, 06:18 AM Re: A piece of code that will include a file in my current directory?
Experienced Talker

Posts: 33
Ok, I'd like to put the content into the template instead of the template being put into the content.

Content including Template:
HTML Code:
<html>

<!--#include virtual="header.shtml" -->

<span class="content">Content makes the world go round</span>

<!--#include virtual="footer.shtml" -->

</html>
If I wanted to put the footer above the content, I would have to change the location of the tag in every page.

Were as if I was to have the one common template that included a local content file, updating would be much easier.

Template including content:
HTML Code:
<html>
 
<Header />

 <!--#include virtual="content.shtml" -->
 
<Footer />

</html>
I could update where important tags are placed in the one template and have that update across the site instantly.

Currently the method of which I am including the content file is not working. The template is looking for the content file in its directory (../template/, and not finding it) when I want it to look for it in its final directory (../about/) as thats where the content file is located.

Sorry if im not understanding your advice correctly

Last edited by Maedi : 05-16-2006 at 06:31 AM.
Maedi is offline
Reply With Quote
View Public Profile Visit Maedi's homepage!
 
Old 05-16-2006, 07:02 AM Re: A piece of code that will include a file in my current directory?
chrishirst's Avatar
Super Moderator

Posts: 13,609
Location: Blackpool. UK
Ok maybe I'm getting this

there are two types of include, file and virtual <self-promo> SSI Includes </self-promo>

My site (and many others I build) is/are comprised almost entirely of sub-folders. This is purely for ease of control and updating.

Each folder will comprise of;
A default document (index.xxx)
A Content file (content.xxx)
A Meta content file (meta.asp)
A specific style sheet (styles.css)

the global includes are then in an includes folder off the root

so the index.xxx file will look something like;
PHP Code:
<!--#include virtual="/includes/dtd.asp" -->
<!--#include virtual="/includes/open_head.asp" -->
<!--#include file="meta.asp" -->
<!--#include virtual="/includes/css/styles.asp" -->
<link rel="stylesheet" type="text/css" src="styles.css">
<!--
#include virtual="/includes/close_head.asp" -->
<!--#include virtual="/includes/open_body.asp" -->
<!--#include virtual="/includes/header.asp" -->
<!--#include virtual="/includes/navigation.asp" -->

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

<!--#include virtual="/includes/footer.asp" --> 
Not the actual file names BTW

Many of theses files are scripted so can determine where they are in the structure and write navigation links and breadcrumbs without me needing to edit anything.
So it's create a folder name it then copy the default structure into it then the only page I need to change is /folder/content.asp. It can also be done dynamically where the content.asp has a script that looks for the content in a database based on the folder name.

Is that the kind of thing you are looking for?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System

Last edited by chrishirst : 05-16-2006 at 07:04 AM.
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-16-2006, 07:28 AM Re: A piece of code that will include a file in my current directory?
Experienced Talker

Posts: 33
Yeh, thats it, youve hit the nail on the head. I like your strucure by the way. I can see that there will still be a little work updating the structure of every page, but thats life.

I could do this:

HTML Code:
<!--# include virtual="/tophalf/" -->
<!--# include file="content.whtevr" -->
<!--# include virtual="/bottomhalf/" -->
This way if I wanted to move the footer above the content, I'd just put it in the tophalf folder, yay.

Many thanks Chris, you've helped alot.

Maedi
Maedi is offline
Reply With Quote
View Public Profile Visit Maedi's homepage!
 
Reply     « Reply to A piece of code that will include a file in my current directory?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15275 seconds with 12 queries