[Hidden-tech] webpage editing question

Sheldon F. Finlay sheldon at jagfly.com
Wed May 11 18:27:25 EDT 2005


Hello Matt,

There are several ways to include content from one HTML document into 
another.  I do most of my work on Unix based servers running Apache and 
PHP, so these examples will appeal directly to those technologies. 
Whether or not you can use them depends upon the limitations of your 
hosting environment.

1) An internal frames (iframe) being an HTML device works regardless of 
server type for basic inclusion. However iframes, as you discovered, are 
prone to browser discrepancies. You can overcome many of the appearance 
mismatches by defining some of the iframe attributes such as 
frameborder, height, width, align, scrolling, etc. It best to control 
these attributes via cascading style sheets (CSS). Personally I avoid 
iframes unless I have no other solution (such as including PDF files 
inline within a web page).

2) Server side includes (SSI) allows you to include external HTML files 
(and executed CGI scripts) into an otherwise static web page. It 
involves renaming your .html files with a .shtml in order to tell the 
server to parse the files for SSI content (which can be overridden via 
the .htaccess config file).  Typical syntax for a SSI includes directive 
looks like so:

<!--#include virtual="/included/content.html" -->


It is possible to introduce some basic "if/else"  logic via SSI. More 
information on all aspects of SSI can be found here:

    http://httpd.apache.org/docs/howto/ssi.html



3) My preferred method is using PHP. You can add content by adding a 
simple include statement such like so:

    <?php include("/path/to/included_file.html"); ?>


And because your dealing with a very robust programming language you can 
pretty much cobble together any logic that suits your needs:

    <?php if ($condition=="meet") {
            include("/this/content.html");
        } elseif {
           include("/that_other/content.html");
        } else {
           // do nothing!
        }
    ?>

 
Of course using PHP requires a web server with PHP support. Also, your 
pages have to end with a PHP extension such as .php (again this can be 
overridden if necessary).

To control the placement and flow of the included content you could 
always wrap the content in a division tag <div>, assign it a id <div 
id="included"> and then use CSS to manage it's appearance and placement 
on the page. This is a very flexible solution.

    EX HTML+PHP...

    <div id="included">
    <?php include('./path/to/included_file.html'); ?>
    </div>

    EX CSS...

#included {
	padding: 12px 0px 0px;
	width: 428px;
	margin-right: auto;
	margin-left: auto;
	position: relative;
	text-align: left;
}

It hard to discuss these techniques in detail without writing a book on 
the topic. Hopefully these overly simplified examples will help point 
you towards a solution that works for you.

Best Regards,

Sheldon F. Finlay
----------------------------------------------------------
Outer Limits Media, Inc.

email :: sheldon at outerlimitsmedia.com
web   :: www.outerlimitsmedia.com
Phone :: 413.253.0051
Fax   :: 413.425.6423 



Florence I.T. wrote:

>   ** Be a Good Dobee and help the group
>   ** Fill out the survey/skills inventory in the member's area.
>   ** Remember you must be counted to post .
>
> To you web developers, Wondering what's the best way to include html 
> from one page into another?
>
> I've used the iframe and the object tags and am currently still using 
> the iframe as it looks slightly better in Internet Explorer (much 
> prefer the look in Firefox) . It's acceptable just wondering if theres 
> a better way. Also wonder is there any way to provide an if-then type 
> display - something simple like alt text with an image, if the link 
> isn't there display something else or nothing at all? Thanks in advance
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.hidden-tech.net/pipermail/hidden-discuss/attachments/20050511/730c7d58/attachment-0009.html 


Google

More information about the Hidden-discuss mailing list