473,698 Members | 2,445 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 #1
22 2898
Sometime around Wed, 22 Oct 2003 02:27:29 GMT, Long is reported to have
stated:
Problem: to insert the content of a file in an HTML document at a specific location.


Solution: http://www.allmyfaqs.com/faq.pl?Incl...ile_in_another

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #2
In article <lW************ ****@news01.blo or.is.net.cable .rogers.com>, one of infinite monkeys
at the keyboard of "Long" <lo***********@ rogers.com> wrote:
Problem: to insert the content of a file in an HTML document at a specific location.
Long ago solved. Many solutions available.
One possible way is to add a WebCharm tag like this:

<%@charm:text 20 0 my_include_file .txt %>
A solution that breaks as soon as some-processor is not available is a poor
solution. Doubly so when some-processor is a specific implementation
as opposed to an open spec.
This work very much like the SSI #include tag.
Nope. SSI doesn't break HTML (or XML) if the processor is not available.
However, you have more control
on how my_include_file .txt is cached.
You have more *useful* control with XBitHack.
In the above example, the file is initially cached
and then fetched after the tag is processed 20 times.
What a mindbogglingly irrelevant criterion for cacheing!
Tag caching (and template caching) increases page generation speed during server
response.
Erm, yes. True (at least so long as the overhead of your engine is less
than the saving), but by no means new.
Visit edgesoft.ca web


Now that's intriguing. Is the similarity of your name to that of Edge-Side
Includes pure coincidence? Guess I'll have to take a look when I can
get a 'net connection.

--
Nick Kew

In urgent need of paying work - see http://www.webthing.com/~nick/cv.html
Jul 20 '05 #3

"Nick Kew" <ni**@fenris.we bthing.com> wrote in message news:ru******** ***@jarl.webthi ng.com...
: In article <lW************ ****@news01.blo or.is.net.cable .rogers.com>, one of infinite monkeys
: at the keyboard of "Long" <lo***********@ rogers.com> wrote:
: > Problem: to insert the content of a file in an HTML document at a specific location.
:
: Long ago solved. Many solutions available.
:
: > One possible way is to add a WebCharm tag like this:
: >
: > <%@charm:text 20 0 my_include_file .txt %>
:
: A solution that breaks as soon as some-processor is not available is a poor
: solution. Doubly so when some-processor is a specific implementation
: as opposed to an open spec.
:
We did not think this was much of a concern, since it should be used WITH
a processor (WebCharm), otherwise there would be no point. However, it is
not difficult to modify the tag to look like:

<!--@charm:text 20 0 my_include_file .txt @-->

We will consider it in the next release.

: > This work very much like the SSI #include tag.
:
: Nope. SSI doesn't break HTML (or XML) if the processor is not available.
:
: > However, you have more control
: > on how my_include_file .txt is cached.
:
: You have more *useful* control with XBitHack.
:
: > In the above example, the file is initially cached
: > and then fetched after the tag is processed 20 times.
:
: What a mindbogglingly irrelevant criterion for cacheing!
:
Consider that the template and tag is cached and you have updated the .txt file
content. How would you un-cache and force reload?

: > Tag caching (and template caching) increases page generation speed during server
: > response.
:
: Erm, yes. True (at least so long as the overhead of your engine is less
: than the saving), but by no means new.
:
: > Visit edgesoft.ca web
:
: Now that's intriguing. Is the similarity of your name to that of Edge-Side
: Includes pure coincidence? Guess I'll have to take a look when I can
: get a 'net connection.
:
Never heard of E-S I. Could you provide a link?

Long

: --
: Nick Kew
:
: In urgent need of paying work - see http://www.webthing.com/~nick/cv.html
Jul 20 '05 #4
"Long" <lo***********@ rogers.com> wrote:
"Nick Kew" <ni**@fenris.we bthing.com> wrote in message news:ru******** ***@jarl.webthi ng.com...
: In article <lW************ ****@news01.blo or.is.net.cable .rogers.com>, one of infinite monkeys
: at the keyboard of "Long" <lo***********@ rogers.com> wrote:
: >
: > In the above example, the file is initially cached
: > and then fetched after the tag is processed 20 times.
:
: What a mindbogglingly irrelevant criterion for cacheing!
:
Consider that the template and tag is cached and you have updated the .txt file
content. How would you un-cache and force reload?


I think you missed Nick's point.
Why 20 times? Why not 19? or 21? Or 20,000?

How do you know in advance how much caching you need? One week you may
only be getting a trickle of visitors between updates, the next week
you're slashdotted.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
Jul 20 '05 #5

"Steve Pugh" <st***@pugh.net > wrote in message news:bb******** *************** *********@4ax.c om...
: "Long" <lo***********@ rogers.com> wrote:
: >"Nick Kew" <ni**@fenris.we bthing.com> wrote in message news:ru******** ***@jarl.webthi ng.com...
: >: In article <lW************ ****@news01.blo or.is.net.cable .rogers.com>, one of infinite monkeys
: >: at the keyboard of "Long" <lo***********@ rogers.com> wrote:
: >: >
: >: > In the above example, the file is initially cached
: >: > and then fetched after the tag is processed 20 times.
: >:
: >: What a mindbogglingly irrelevant criterion for cacheing!
: >:
: >Consider that the template and tag is cached and you have updated the .txt file
: >content. How would you un-cache and force reload?
:
: I think you missed Nick's point.
: Why 20 times? Why not 19? or 21? Or 20,000?
:
Ah... 20 times is just for the example. The author marking up the tag can specify
an appropriate value for his/her use, base on experience or guestimate.

: How do you know in advance how much caching you need? One week you may
: only be getting a trickle of visitors between updates, the next week
: you're slashdotted.
:
: Steve
:
: --
: "My theories appal you, my heresies outrage you,
: I never answer letters and you don't like my tie." - The Doctor
:
: Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
Jul 20 '05 #6
"Long" <lo***********@ rogers.com> wrote:
"Steve Pugh" <st***@pugh.net > wrote in message news:bb******** *************** *********@4ax.c om...
: "Long" <lo***********@ rogers.com> wrote:
: >"Nick Kew" <ni**@fenris.we bthing.com> wrote in message news:ru******** ***@jarl.webthi ng.com...
: >: In article <lW************ ****@news01.blo or.is.net.cable .rogers.com>, one of infinite monkeys
: >: at the keyboard of "Long" <lo***********@ rogers.com> wrote:
: >: >
: >: > In the above example, the file is initially cached
: >: > and then fetched after the tag is processed 20 times.
: >:
: >: What a mindbogglingly irrelevant criterion for cacheing!
: >:
: >Consider that the template and tag is cached and you have updated the .txt file
: >content. How would you un-cache and force reload?

: I think you missed Nick's point.
: Why 20 times? Why not 19? or 21? Or 20,000?
:
Ah... 20 times is just for the example. The author marking up the tag can specify
an appropriate value for his/her use, base on experience or guestimate.


I know that 20 is just an example, but you are still missing the
point. What does the number of times the document has been accessed
have to do whether it should be cached or not? Why not base the
decision to cache on something more relevant such as the date, or the
freshness of the include file?

The cache we are talking about here is on the web charm enabled web
sevrer, 'cos nothing you put in the include instruction is going to
affect proxy or browser caches, right? So why not include a nice
littel control panel that let's the author flush the cache clear at
his discretion? Or have the server automatically flush the cache when
a new include file is uploaded. Why reduce it to guessing based on how
many times the final page has been accessed?

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
Jul 20 '05 #7
On Wed, 22 Oct 2003, Long wrote:
"Steve Pugh" <st***@pugh.net > wrote in message news:bb******** *************** *********@4ax.c om... : I think you missed Nick's point.
: Why 20 times? Why not 19? or 21? Or 20,000?
:
Ah... 20 times is just for the example.
Now we _know_ you missed Nick's point.
The author marking up the tag can specify
an appropriate value for his/her use, base on experience or guestimate.


You evidently don't understand yet that it wasn't the specific _value_
that was at issue, but the very idea of basing cacheability on such an
irrelevant quantity, no matter *what* its value.
Jul 20 '05 #8

"Steve Pugh" <st***@pugh.net > wrote in message news:48******** *************** *********@4ax.c om...
: "Long" <lo***********@ rogers.com> wrote:
: >"Steve Pugh" <st***@pugh.net > wrote in message news:bb******** *************** *********@4ax.c om...
: >: "Long" <lo***********@ rogers.com> wrote:
: >: >"Nick Kew" <ni**@fenris.we bthing.com> wrote in message news:ru******** ***@jarl.webthi ng.com...
: >: >: In article <lW************ ****@news01.blo or.is.net.cable .rogers.com>, one of infinite
monkeys
: >: >: at the keyboard of "Long" <lo***********@ rogers.com> wrote:
: >: >: >
: >: >: > In the above example, the file is initially cached
: >: >: > and then fetched after the tag is processed 20 times.
: >: >:
: >: >: What a mindbogglingly irrelevant criterion for cacheing!
: >: >:
: >: >Consider that the template and tag is cached and you have updated the .txt file
: >: >content. How would you un-cache and force reload?
: >
: >: I think you missed Nick's point.
: >: Why 20 times? Why not 19? or 21? Or 20,000?
: >:
: >Ah... 20 times is just for the example. The author marking up the tag can specify
: >an appropriate value for his/her use, base on experience or guestimate.
:
: I know that 20 is just an example, but you are still missing the
: point. What does the number of times the document has been accessed
: have to do whether it should be cached or not? Why not base the
: decision to cache on something more relevant such as the date, or the
: freshness of the include file?
:
: The cache we are talking about here is on the web charm enabled web
: sevrer, 'cos nothing you put in the include instruction is going to
: affect proxy or browser caches, right? So why not include a nice
: littel control panel that let's the author flush the cache clear at
: his discretion? Or have the server automatically flush the cache when
: a new include file is uploaded. Why reduce it to guessing based on how
: many times the final page has been accessed?
:
Having the author manually flush the cache is a bad idea. I centainly would
not want to do it. Within an ISP environment how would you control who
flushes what?

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.

--
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 #9

"Alan J. Flavell" <fl*****@ph.gla .ac.uk> wrote in message
news:Pi******** *************** ********@ppepc5 6.ph.gla.ac.uk. ..
: On Wed, 22 Oct 2003, Long wrote:
:
: > "Steve Pugh" <st***@pugh.net > wrote in message
news:bb******** *************** *********@4ax.c om...
:
: > : I think you missed Nick's point.
: > : Why 20 times? Why not 19? or 21? Or 20,000?
: > :
: > Ah... 20 times is just for the example.
:
: Now we _know_ you missed Nick's point.
:
: > The author marking up the tag can specify
: > an appropriate value for his/her use, base on experience or guestimate.
:
: You evidently don't understand yet that it wasn't the specific _value_
: that was at issue, but the very idea of basing cacheability on such an
: irrelevant quantity, no matter *what* its value.

May be so. Perhaps you will change your mind after reading my reponse
to Steve's post.

--
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 #10

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

Similar topics

2
2455
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
2139
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
1913
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
1667
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
2119
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
2263
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
26608
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
3376
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
3146
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
4185
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
8604
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
9160
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
9029
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
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4370
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.