4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2018, 08:45:05 PM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Help / Hilfe
| |-+  FAQ, Tips
| | |-+  How can I include another PHP file in the templates?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 » »» Print
Author Topic: How can I include another PHP file in the templates?  (Read 111030 times)
Chris
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4487

Thank You
-Given: 0
-Receive: 31

Did u ever stop to think and then forget to start?


View Profile
« 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:
1
2
3
<?php 
include($_SERVER['DOCUMENT_ROOT']."/relative/path/to/my/include.php"); 
?>
Next, open includes/constants.php and change
1
2
// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 0);
to this
1
2
// 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
1
2
3
<?php
include("./somephpfile.php");
?>
the somephpfile.php must be placed in includes/ folder.
« Last Edit: January 29, 2006, 07:56:18 AM by V@no » Logged

khan
Newbie
*
Offline Offline

Posts: 35

Thank You
-Given: 2
-Receive: 3


View Profile
« Reply #1 on: July 31, 2005, 10:51:49 PM »

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.
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #2 on: July 31, 2005, 10:58:50 PM »

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

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
khan
Newbie
*
Offline Offline

Posts: 35

Thank You
-Given: 2
-Receive: 3


View Profile
« Reply #3 on: August 03, 2005, 08:57:39 PM »

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.
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #4 on: August 04, 2005, 01:03:01 AM »

sounds like a conflict between 4images and your script.
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
tatty
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #5 on: February 23, 2006, 02:59:13 AM »

Hello.
For me it's not working too Sad
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!
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #6 on: February 23, 2006, 03:23:04 AM »

Did you apply all the bug fixes? I guess you didnt.
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
killerwhale65
Newbie
*
Offline Offline

Posts: 19

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #7 on: March 10, 2006, 12:41:10 PM »

what if i want to include a php file on the frontpage (index.php)? How can i do that?

thanks!
Logged
mawenzi
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4500

Thank You
-Given: 36
-Receive: 121


View Profile
« Reply #8 on: March 10, 2006, 01:51:27 PM »



Exactly the same as here described !
Logged

Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...
killerwhale65
Newbie
*
Offline Offline

Posts: 19

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #9 on: March 10, 2006, 01:54:23 PM »

and what is the html template i should use? I dont find an index.html ...
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« Reply #10 on: March 10, 2006, 01:56:51 PM »

home.html
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
mawenzi
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4500

Thank You
-Given: 36
-Receive: 121


View Profile
« Reply #11 on: March 10, 2006, 01:59:20 PM »

as you can see on top of index.php
1
$main_template = 'home';

the template for index.php ist home.html ...  Exclamation
Logged

Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...
colorssky
Full Member
***
Offline Offline

Posts: 128

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #12 on: October 09, 2006, 11:03:23 PM »

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

Logged
iraklis
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #13 on: January 05, 2007, 03:10:56 PM »

Î've problems too.

Parse error: parse error, unexpected '/' in /dev/httpdocs/includes/template.php(133) : eval()'d code on line 372

Anybody an idea?
Logged
KurtW
4images Guru
*******
Offline Offline

Posts: 2778

Thank You
-Given: 0
-Receive: 8


View Profile WWW
« Reply #14 on: January 06, 2007, 02:52:22 PM »

Hi colorssky,

1
2
3
<?php 
include($_SERVER['DOCUMENT_ROOT']."/poll/booth.php"); 
?>

To iraklis

To mutch / in your code.



cu
Kurt
Logged

Pages: [1] 2 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.054 seconds with 19 queries.
Post your comments here