Daniel-B
Daniel-B

Reputation: 111

Include footer page to any page in the server

I want to Include some footer page to any page in my server without calling the file from the pages.

I know that there is a way to do that with apache or something like that, but I have no idea how to do that.

Upvotes: 1

Views: 202

Answers (3)

Michael Berkowski
Michael Berkowski

Reputation: 270599

In your .htaccess, you can do it with:

php_value auto_append_file 'footer.php'

The file must exist in PHP's include_path. See the documentation for slightly more information.

The auto_append_file directive can also be set in php.ini.

Upvotes: 2

DerVO
DerVO

Reputation: 3679

I suggest going with register_shutdown_function() instead of auto_append_file, because the auto_append_file is not executed if the main script is terminated with exit. This is a very important difference between both options.

Upvotes: 2

symcbean
symcbean

Reputation: 48357

In addition to DerVO's answer...

It may be possible (but it's not trivial) to force a div included earlier in the output stream to be rendered at the bottom of the page using CSS. Alternatively you could output the content in a non-displayed div and use javascript to append a copy of its innerHTML to the inner html of the last element in the body.

Upvotes: 0

Related Questions