473,729 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to include a file in an HTML doc

Problem: to insert the content of a file in an HTML document at a specific location.

One possible way is to add a WebCharm tag like this:

<%@charm:text 20 0 my_include_file .txt %>

When the HTML template is processed by a WebCharm-aware web server, the
content of my_include_file .txt is inserted at the tag location.

This work very much like the SSI #include tag. However, you have more control
on how my_include_file .txt is cached. In the above example, the file is initially cached
and then fetched after the tag is processed 20 times. That is, fetched once per 20 requests.
Tag caching (and template caching) increases page generation speed during server
response.

Visit edgesoft.ca web site for more information on WebCharm template and tags.
In particular, www.edgesoft.ca/go/index.html?top=wc

--
Long On
Edgesoft Consulting Inc.
webcharmer @ www.edgesoft.ca/go/member/index.html
www.edgesoft.ca/go/index.html
www.edgesoft.ca


Jul 20 '05
22 2903
"Bruce Lewis" <br*****@yahoo. com> wrote in message news:nm******** *****@magic-pi-ball.mit.edu...
: "Long" <lo***********@ rogers.com> writes:
:
: > "Bruce Lewis" <br*****@yahoo. com> wrote in message news:nm******** *****@magic-pi-ball.mit.edu...
: > : "Long" <lo***********@ rogers.com> writes:
: > :
: > : > "Matt" <ma**********@h otmail.com> wrote in message
: > : > news:pa******** *************** *****@hotmail.c om...
: > : > : Why not check the modification date of the included file, see if it's
: > : > : changed, and then decide if the cached page is current? That way, zero
: > : > : visitors get the outdated page! :-)
: > : > :
: > : > How is this diffent than refresh on every request? You'd still need to
: > : > access the file system at each request, to check for the modification
: > : > date. If the size of the include file is not huge, the performance
: > : > gain would be minimal to none.
: > :
: > : I think most filesystems do a certain amount of in-memory caching for
: > : file mod times.
: > :
: > Perhaps.
:
: Do a google search for "inode cache". One of your supported platforms
: (Linux) does exactly this. I doubt it's different from other Unix
: implementations . You can configure the size of your inode cache
: according to your server's needs.
:
Thanks for the pointer. Very helpful.

: > : I don't think most filesystems do in-memory caching of
: > : file contents.
: > :
: > WebCharm allows in-memory caching of templates and include files to
: > help reduce file I/O, but by no means 100%. This does depend on how a
: > template and containing tags are configured.
:
: Your question was "How is this different than refresh on every request?"
: I answered that. Matt's suggestion reduces file I/O better than
: WebCharm does.
:
Now that I know about "inode cache". In the next release, we will consider
checking for file mod timestamp, to refresh the cached content. It probably will
simplify the tag syntax as well. Thank you both.

: For example, if you're using BRL and do
:
: [(paste "my_include_fil e.txt")]
:
BRL? Never heard of it...until now. I had a quick look and it is very interesting.
BRL seems to be equivalent to WebCharm/e (enterprise edition) in terms
of functionality. One difference is in BRL's own programming language, instead
of Scheme. Whereas, WebCharm is base solely on templates and tags and
new functions in WebCharm/e are programed in Smalltalk.

: You'll get better I/O performance (and probably better overall
: performance) than with WebCharm's alternative:
:
: <%@charmcnf: pageRequestServ let , 1, *, 2, 60 %>
: <%@charm:text 20 0 my_include_file .txt %>
:
I do appreciate that you actually spend some time to evaluate WebCharm.

: I notice you left that first line out from your initial helpful post.
: Your authoring guide says it's required.
:
This is correct, I wanted to only concentrate on the #include equivalent tag. But
in practice, a WebCharm template is identified by the inclusion of a @charmcnf
signature.

: > : The Apache version of your product is hitting the filesystem for most
: > : requests anyway, to launch the CGI program.
: > :
: > Yes, this is an inherent behavior of CGI and it is out of our
: > control. Although, the CGI module (abtwsac) is only 30K in size so the
: > overhead is not too bad. WebCharm on the other hand is a separate
: > application that stays resident in memory, once launched.
:
: So don't use CGI. BRL doesn't. PHP doesn't. SSI doesn't. You're
: behind the pack. And the alternatives I mentioned are all free.
:
We do have access to a CGI alternative that is Java-based and runs within
a Java container (such as Tomcat). Performance wise, it is much better than
CGI. However it is a can of worm to install and configure. We wanted to keep
WebCharm easy to install and use as a trade-off, so we excluded the option.

Regards,

Long

Jul 20 '05 #21
On Wed, 22 Oct 2003 16:06:46 +0000, Long wrote:
: >: >: "Long" <lo***********@ rogers.com> wrote:
: >: >: > In the above example, the file is initially cached
: >: >: > and then fetched after the tag is processed 20 times. <snip missing-the-point> In the larger scheme, a WebCharm template can be configure to un-cache
after a period of inactivity (i.e. no page requests). This un-caches all contained
tags so everthing gets flushed automatically. A different scenario happens when
the template is so busy serving requests that it never (may be days) get flushed and
in the mean time you have changed the include content. Having the tag flush
periodically helps keep content up to date, sooner. We could have chosen to do a
time-flush at the tag level, but a count-flush work just as well.


Er... no it doesn't. What if the page is flushed, then viewed once, then I
change the content. The next _19_ (for example) visitors get an out of
date page!

Likewise with time: All visitors in the next (e.g.) 5 minutes get the
outdated page!

Why not check the modification date of the included file, see if it's
changed, and then decide if the cached page is current? That way, zero
visitors get the outdated page! :-)

HTH :-) HAND

--
Matt
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #22
Matt wrote:
Why not check the modification date of the included file, see if it's
changed, and then decide if the cached page is current? That way, zero
visitors get the outdated page! :-)


That's only really possible iff all your included content has
timestamps. If you start generating pages from database content (most
of the time; there are some CMS schema that actually have useful time
information) or output from a program, then you're pretty much stuck
assuming that the data will be fresh for a specific period of time. In
some cases with databases, the overhead of checking the timestamp is
high enough that you may as well either not bother or pull the whole
page anyways, at which point you lose the benefit of caching.

Granted, the OP isn't doing that, s/he's including a .txt file, but
it's something to think about.

Owen
Jul 20 '05 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2459
by: Kupo | last post by:
Hi, I'm currently writing website using php. My problem is, when I do: include("../../library/file.php"); // this is from e.g /level1/level2/something.php it works. However, when I use: include("../../../library/file.php"); // and this one from /level1/level2/level3/something.php
2
2141
by: Greg | last post by:
I'm new to html and web coding, this is a simple one - appreciate your help! I'm attempting to get my browser bar links to reside in a single .asp file to avoid multiple additions to pages when I add a page to the site. I've done a lot of reading and surfing, believe I know how to do it, but can't get it to work. I've installed IIS on my machine running XP pro, and have
21
1918
by: .:mmac:. | last post by:
I have to update a page every week. I get the page ahead of time so I used the "scheduled includes" webbot in Frontpage only to find that I would have to refresh the page every week to have it work. That is silly, it should run by itself. so... I asked the question in the FP group and I was offered this pseudocode to do it by month which would work if it's possible to do it by week without writing 52 seperate lines, one for each week which...
14
1669
by: Adam | last post by:
Hi All, Is it possible to use includes dynamically in html. Hopefully the following example will give an idea what I am rying to do. Thanks in advance Adam <script language="javascript">
6
2125
by: tshad | last post by:
In my User control, I tried to do this: *************************************************************************** <Script runat="server"> Public ClientName As String = "<!-- #include file = ...\includes\StaffingHeaders.inc -->" </Script> <%=ClientName%> ****************************************************************************
11
2266
by: MBS | last post by:
I am playing around with some PHP code. I want to put in an include() function so I can include existing HTML code and output it to the browser. Lo and behold PHP does not support relative paths with the include() function! (How shortsighted can you get?) Is there any way at all to use relative paths with include()? Any hacks? If I use an absolute filepath, everything is fine. But I don't want to do that--I can't do that. I want...
11
26611
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
4
3380
by: Jon Slaughter | last post by:
I'm using eval to excute some mixed php and html code but I cannot debug it. I am essentially using filegetcontents to load up a php/html file and then inserting it into another php/html file and then using eval to execute the final product. If I were to use include and output buffering instead of filegetcontents would it allow be to debug the code? (I have to capture the include so it can be modified which is why I used...
14
3157
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the PHP interpreter works like any other, that is, it first expands all the include files, and then parses the resulting text. Can anyone help with an explanation? Thanks, M. McDonnell
6
4191
by: j.woodcock | last post by:
is there a way of having a file that's name is a variable (eg dependant on the user name) act like a include. i know that you cant define the file for an include asp tag using a variable and that reading the file using "Response.Write FSO.OpenTextFile(ppp, 1, False, False).readall" prints the file, and treating it like a html file. can anyone suggest another way of doing this?
0
8763
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9284
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.