|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Unsert Banner automaticly ???
I'm trying to figure out how to insert a banner (or header/footer) in every page viewed in a directory, without individualy inerting code in each page. Sort of what they do at various host services where they add an advertising banner.
Running a virtual host, with Apache. Something along the idea of a redirect for all files, feeding them into a CGI or PHP file for processing before being sent to the browser. How is it done ? (Can it be done?) Bob |
|
#2
|
|||
|
|||
|
maybe you should look into php includes. You can set a header/footer files with them
for example top.php code PHP Code:
bottom.php code PHP Code:
index.php PHP Code:
Lets say you want a banner add at the bottom of each page, you would add the img tag to the bottom.php file. |
|
#3
|
|||
|
|||
|
Problem is that PHP, SSI, Javascript can all be used, if a line of code is in the file. But I need to let users upload their files, without any extra text added, and somehow get the banner on it when displayed.
What is used on free hosts like NetFirms etc to insert it??? Bob |
|
#4
|
|||
|
|||
|
Quote:
I have your answer, however there are a couple ways to do this: If you examine the php.ini file, you will notice the following config lines: ; Automatically add files before or after any PHP document. auto_prepend_file = auto_append_file = If you do not have access to your php.ini and your host is running the asapi / mod_php version, then you should use your .htaccess file and include this following line: php_value auto_prepend_file /real/path/to/your/file That line adds something to the top of your files. -- Wil Moore III www.wilmoore.com
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#5
|
|||
|
|||
|
That sounds like it willl work with PHP files, but what about .html ??
Bob |
|
#6
|
|||
|
|||
|
Anything that is run through the php parser can be appended to.
If you need .html or .htm files to be worked on as well, then add this to your .htaccess file or php.ini: AddType application/x-httpd-php html htm |
|
#7
|
|||
|
|||
|
I was just thinking of that...
trying to get this working with my hosts CGI Wrapper - itt gets a bit picky |
|
#8
|
|||
|
|||
|
If my bag-o-tricks is correct, if you are running the php cgi version you can use your own local copy of the php.ini and modify your settings there.
|
|
#9
|
|||
|
|||
|
that's next - find the copy of it
|
|
#10
|
|||
|
|||
|
Almost!!!
The php.ini setting worked !!! ( could find some neat uses for this!!!) It doesn't seem to like the attempot to treat .html as .php though when I try, it downloads the file and opens it localy in a new window!!! |
|
#11
|
|||
|
|||
|
You may not be overriding the default mime type for the .html or .htm extension depending on where you are setting it.
If you are setting this from the .htaccess file you should be getting the desired results. I'd check there first. |
|
#12
|
|||
|
|||
|
Quote:
????? it just downloads and opens any .htm files localy |
|
#13
|
|||
|
|||
|
OK - The php.ini file took care of the append & prepend files
Tried AddType etc in the .htacess file, for that directory, it works properly with .php files and I can even make it work with .bob files (for a test)but it refuses to work with .htm or .html files it just downloads the file and opens in in a new window from a local temp directory!!!! ![]() |
|
#14
|
|||
|
|||
|
I've got it!!! (sort of)
Took out the code for server-parsing html/htm files in the sites's root directory - they aren't compatible! |
|
#15
|
|||
|
|||
|
What about perl ? It worked alright for php and html, but how to add them in cgi ?
![]() |
|
#16
|
||||
|
||||
|
For perl, you could just add a handler and have the server route any .pl or .cgi requests through it. The handler would execute the perl code and then add whatever extra output you want added before printing the results. In fact, you could do this for any file type.
Or you could probably associate .pl and .cgi with PHP and write in a special condition that executes "/usr/bin/perl filename.cgi" and returns the output, though there are potential security risks there and I'm not positive it would work anyway. |
|
#17
|
|||
|
|||
|
Couldn't quite get a it, what is a handler?
thanks for any help... |
|
#18
|
||||
|