Welcome to WebmasterWorld Guest from 184.108.40.206
First time poster, long time lurker. I'd like to redesign my site to make it easier for me to make site-wide changes, and I am in need of some basic information.
In my HTML code:
document.write("tags and content") ;
If someone could suggest a way to duplicate this in Perl, PHP, or some other server-side method while retaining the two-file format (HTML + external code file), it would be very much appreciated. I'm running on Apache 1.3.29 on a linux box. If there is any special configuration information I might need to get it running, that would also be helpful.
PS. I'm primarily a C++/VB guy, and server-side web stuff is not my strong area. Please be gentle :)
You can do this in both Perl and PHP. I think that the PHP way of doing things is perhaps more conceptually similar to the way you're doing things now. Instead of including <script> tags in your html, you'd use something like this:
where yourincludefile.php contains the code to generate whatever dynamic content you want.
You'd also have to change your .html file to .php, unless you add a line to your .htaccess file to parse .html pages for PHP:
AddType application/x-httpd-php .html
On it's own, Perl turns the concept on it's head - you generally build a dynamic page and include any static html either by a simple print command, or using 'require' to pull it in from an external file. If you wanted to use Perl, your situation would probably be best dealt with by a combination of Perl and Server Side Includes (SSI). Again, instead of the script tags, you'd use:
<!--#include virtual="/cgi-bin/yourscript.pl" -->
where yourscript.pl generated the dynamic stuff.
Again, you'd have to modify your .htaccess file to tell the server to parse for SSI
AddHandler server-parsed .html