Hard-coding a page...
Moderator: General Moderators
Hard-coding a page...
This may sound weird, but I know it's possible.
I would like to implant a bit of code into every page loaded on my server, without actually editing those pages (like manually implanting the code). It's how my current free host implants their adverts on my website... I believe it has something to do with editing .htaccess...
I would like to implant a bit of code into every page loaded on my server, without actually editing those pages (like manually implanting the code). It's how my current free host implants their adverts on my website... I believe it has something to do with editing .htaccess...
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Not sure if thats PHP or some sort of CNAME alias to a framed version of the site (or mod_rewrite)...
Using include(); and mod_rewrite it can be done.
Havent used mod_rewrite for ages so my syntax might be out...
Using include(); and mod_rewrite it can be done.
Code: Select all
<?php
include('the_include_file.php');
include($_GETї'page']);
?>Code: Select all
RewriteEngine On
RewriteRule ^(/.*)$ /frameholder.php?page=$1you can use the following options:
http://be.php.net/manual/en/ini.core.ph ... epend-file
http://be.php.net/manual/en/ini.core.ph ... ppend-file
http://be.php.net/manual/en/ini.core.ph ... epend-file
http://be.php.net/manual/en/ini.core.ph ... ppend-file
All your ideas are all following the same path: Having to edit each and every file to add some code. This isn't PHP. That's why I don't have it in PHP-Code. I have it in Misc. There's something to do with the server itself or .htaccess that would allow me to when a page is loaded, to embed code into a page when it loads.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
might want to take a look at the apache ssi guide at http://httpd.apache.org/docs/howto/ssi. ... dardfooter
I don't want to sound ungrateful or anything phpdevuk... But your help was the least helpful I've ever had. I know what SSI is, but it the point is that I don't WANT to edit into EVERY page. I've said it in almost all my posts now...phpdevuk wrote:might want to take a look at the apache ssi guide at http://httpd.apache.org/docs/howto/ssi. ... dardfooter
timvw wrote:you can use the following options:
http://be.php.net/manual/en/ini.core.ph ... epend-file
http://be.php.net/manual/en/ini.core.ph ... ppend-file
Code: Select all
php_flag auto-prepend-file "e;path_to_your_file"e;
php_flag auto-append-file "e;path_to_your_file"e;Nothing, those are both perfectly plausable ideas ^_^;; I, personally, already have my own script set up that redirects a page if viewed without the main layout being present (file.php instead of index.php?variable=file). I was mainly doing this to give a friend of mine an idea of his abilities to do this kind of thing. The funny part is eventually, he'll be making all his data database driven... So doing this is kind of useless, but still interesting to know.