4images Help / Hilfe > FAQ, Tips

How can I include another PHP file in the templates?

(1/5) > >>

Chris:
Open the 4images html template where you would like to include your PHP file and include it like this:

--- Code: ---<?php 
include($_SERVER['DOCUMENT_ROOT']."/relative/path/to/my/include.php"); 
?>
--- End code ---
Next, open includes/constants.php and change

--- Code: ---// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 0);
--- End code ---
to this
--- Code: ---// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 1);
--- End code ---

PLEASE be sure to read this FAQ forum topic: http://www.4homepages.de/forum/index.php?topic=3378
for information regarding some limitations and possible solutions for working with certain types of PHP scripts.

[UPDATE]
If you are using relative path ./ inbetween the templates, then be advised, that php will look for files in includes/ directory and not 4images root!
i.e. if used
--- Code: ---<?php
include("./somephpfile.php");
?>
--- End code ---
the somephpfile.php must be placed in includes/ folder.

khan:
HI
I Did every thing described above but php including does not works in my templates.
at the place where i included the php file its display blank area and does not Showing the data of the included Php file.

V@no:
and what does it show u when u try open that file directly in the browser as a web page?

khan:
Hi
When i open it in browser it display every thing inside the files. but when i include it in 4images it displays blank white area.

V@no:
sounds like a conflict between 4images and your script.

Navigation

[0] Message Index

[#] Next page

Go to full version