4images Forum & Community
4images Help / Hilfe => FAQ, Tips => Topic started by: Chris on February 23, 2003, 10:02:35 PM
-
Open the 4images html template where you would like to include your PHP file and include it like this:
<?php
include($_SERVER['DOCUMENT_ROOT']."/relative/path/to/my/include.php");
?>
Next, open includes/constants.php and change
// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 0);
to this// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 1);
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 <?php
include("./somephpfile.php");
?>
the somephpfile.php must be placed in includes/ folder.
-
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.
-
and what does it show u when u try open that file directly in the browser as a web page?
-
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.
-
sounds like a conflict between 4images and your script.
-
Hello.
For me it's not working too :(
I've done what told in the post, but when I click "save changes" it shows me a blank space. I go to the gallery page and no changes were done! I mean, I add the php include but no changes happen.
Any suggestion? Thanks!
-
Did you apply all the bug fixes? I guess you didnt.
-
what if i want to include a php file on the frontpage (index.php)? How can i do that?
thanks!
-
...How can i do that? ...
Exactly the same as here (http://www.4homepages.de/forum/index.php?topic=4295.msg17676#msg17676) described !
-
and what is the html template i should use? I dont find an index.html ...
-
home.html
-
as you can see on top of index.php
$main_template = 'home';
the template for index.php ist home.html ... :!:
-
I tried to add the follwing, because I am using poll script
______________
<?php
include($_SERVER['DOCUMENT_ROOT']."/home/takfeed/public_html/poll/booth.php'");
display_booth(1); ?>
_______________
but I got this error
Warning: Unknown(/home/takfeed/public_html/home/takfeed/public_html/poll/booth.php'): failed to open stream: No such file or directory in /home/takfeed/public_html/shop/includes/template.php(101) : eval()'d code on line 84
Warning: Unknown(/home/takfeed/public_html/home/takfeed/public_html/poll/booth.php'): failed to open stream: No such file or directory in /home/takfeed/public_html/shop/includes/template.php(101) : eval()'d code on line 84
Warning: (null)() [function.include]: Failed opening '/home/takfeed/public_html/home/takfeed/public_html/poll/booth.php'' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/takfeed/public_html/shop/includes/template.php(101) : eval()'d code on line 84
Fatal error: Call to undefined function: display_booth() in /home/takfeed/public_html/shop/includes/template.php(101) : eval()'d code on line 85
-
Î've problems too.
Parse error: parse error, unexpected '/' in /dev/httpdocs/includes/template.php(133) : eval()'d code on line 372
Anybody an idea?
-
Hi colorssky,
<?php
include($_SERVER['DOCUMENT_ROOT']."/poll/booth.php");
?>
To iraklis
To mutch / in your code.
cu
Kurt
-
is there anybody who could help me? i tried everything but i can't include a php file. maybe i used the wrong directory.
i would like to include the index page of a guestbook which you can find in www.mydomain.com/templates/default/guestbook/index.php
what would be the right code to include this into an html-template site?
-
Exactly the same as here described !
-
you can not include a php file/page into a html page, if your html page is a template for 4images then follow directions again.
Otherwise if you have a home page that is a html page you can not call a php page into it.
-
WeŽll I think if you want to integrate a complete new php-file you have to do:
edit: all files
categories.php
details.php
index.php
lightbox.php
member.php
postcards.php
register.php
search.php
top.php
search for this:
require(ROOT_PATH.'includes/sessions.php');
and add this after:
include(ROOT_PATH.'my_new_phpfile.php');
Upload your new phpfile in the root of your 4images installation.
There was a topic where chris has written how you can call this file in your template html-files
-
Is there a special trick to getting the 4images tags (e.g. {template_url} {if random_image} {site_name}) to work within an include file called from a template file e.g. home.html, details.html?
See my post here for more info:
http://www.4homepages.de/forum/index.php?topic=18003.msg95825 (http://www.4homepages.de/forum/index.php?topic=18003.msg95825)
-
... there is no trick ...
... the tags works only in the templates by their php-files in which they was generated ...
... e.g. ...
... tags in home.html are generated in index.php ...
... tags in details.html are generated in details.php ...
... a.s.o. ...
... but some tags are generated in functions.php ...
... to use the tags in templates you must call the pertinent php-file in the browser, not the template-file ...
... so ...
... if you want to use tags, you must edit a php-file which generated these tags and call the template ...
... have a look in details.php ... and ... details.html to see how it works in 4images ...
-
ok, i think i sort of understand. the tags will only work when a template file is read from a php file e.g.
$site_template->print_template($site_template->parse_template($main_template));
am i understanding this right? that is a shame, i wish it would just parse / read the tags from include files called from templates.
what if i want to call a template within a template?
this is what i am trying to achieve. the templates are labourious to update. if i make a change i generally have to update all of them. since nearly all of the templates are indentical except for the contents of one table cell, i would like the non changing content to be one file and the changing content as another file. this way if i update a header or something like that, then i don't have to edit all of the templates.
-
I have long long been looking ....... I wish I searched here before trying to figure out this alone.
-
Open the 4images html template where you would like to include your PHP file and include it like this:
<?php
include($_SERVER['DOCUMENT_ROOT']."/relative/path/to/my/include.php");
?>
works like a breeze. so easy. thank you very much.
-
If use in 4images -
replace:
include($_SERVER['DOCUMENT_ROOT']."/relative/path/to/my/include.php");
for:
include($HTTP_SERVER_VARS['DOCUMENT_ROOT']."/relative/path/to/my/include.php");