4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 15, 2018, 09:10:11 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 112139 times)
osnapicture
Full Member
***
Offline Offline

Posts: 152

Thank You
-Given: 10
-Receive: 0


View Profile
« Reply #15 on: February 21, 2007, 11:10:01 PM »

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?
« Last Edit: February 21, 2007, 11:35:38 PM by osnapicture » Logged
shaiba81
Pre-Newbie

Offline Offline

Posts: 4

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #16 on: March 29, 2007, 05:46:41 AM »

Exactly the same as here described !
Logged
CeJay
Sr. Member
****
Offline Offline

Posts: 425

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #17 on: March 29, 2007, 06:59:41 AM »

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.
Logged
Flo2005
Full Member
***
Offline Offline

Posts: 237

Thank You
-Given: 0
-Receive: 1

Copy & Paste Profi :)


View Profile WWW
« Reply #18 on: April 01, 2007, 02:07:07 PM »

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:
1
require(ROOT_PATH.'includes/sessions.php');

and add this after:
1
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
Logged


Project offline
adrian.gab
Newbie
*
Offline Offline

Posts: 10

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #19 on: July 10, 2007, 02:38:40 PM »

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
Logged
mawenzi
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4500

Thank You
-Given: 36
-Receive: 121


View Profile
« Reply #20 on: July 10, 2007, 03:06:33 PM »

... 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 ...
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) ...
adrian.gab
Newbie
*
Offline Offline

Posts: 10

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #21 on: July 10, 2007, 04:20:43 PM »

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.



Logged
webmaster73
Jr. Member
**
Offline Offline

Posts: 75

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #22 on: July 27, 2007, 11:29:42 PM »

I have long long been looking .......  I wish I searched here before trying to figure out this alone.

Logged
webmaster73
Jr. Member
**
Offline Offline

Posts: 75

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #23 on: September 28, 2007, 02:20:54 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"); 
?>


works like a breeze. so easy. thank you very much.
Logged
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2327

Thank You
-Given: 0
-Receive: 10


View Profile
« Reply #24 on: September 28, 2007, 08:34:04 PM »

If use in 4images -

replace:

Quote  [Expand]
include($_SERVER['DOCUMENT_ROOT']."/relative/path/to/my/include.php");

for:

1
include($HTTP_SERVER_VARS['DOCUMENT_ROOT']."/relative/path/to/my/include.php");
Logged

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?
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.075 seconds with 19 queries.