4images Forum & Community

General / Allgemeines => Chit Chat => Topic started by: ID25 on August 13, 2005, 05:55:41 PM

Title: include to the templates no problem in 1.7.1
Post by: ID25 on August 13, 2005, 05:55:41 PM
i can include to the templates

ex: <?php echo("menu.php"); ?>

i know what in version 1.7 4images this not working, but on 1.7.1 this working ok :)
and no problem, what you say, there is ok at this version?
Title: Re: include to the templates no problem in 1.7.1
Post by: V@no on August 13, 2005, 07:32:35 PM
ok, are you having problem or what? what is your question? if u looking for an oppinion, then this topic is belong to chit-chat forum, if you are experiencing problem then please tell so.
otherwise look in the FAQ on how to properly include another .php file in the templates.
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 13, 2005, 08:14:00 PM
There is Discussion and topic is  Discussion...

 Discussion about:
or there is bug, or all ok in 1.7.1 version
May i can include <?php echo("file.php"); ?>
there is no problem on that version?

Why i must do this:
Code: [Select]
<?php
include($_SERVER['DOCUMENT_ROOT']."/images/file.php");
?>


if i can do this in simple mode <?php echo("file.php"); ?>
in 1.7.1 version
Title: Re: include to the templates no problem in 1.7.1
Post by: V@no on August 13, 2005, 08:21:58 PM
1) echo("file.php") will output file.php as a string and not content of the file.php file.
2) the point of the topic in FAQ is that u SHOULD NOT have anything on the same line with <?php and ?> and not about what kind of path must be used for the included file.

P.S. I'm moving this topic in Chit-Chat.
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 13, 2005, 08:53:08 PM
if i put echo("file.php") in home.html there is ok?
if in file.php just HTML code

maybe 4images faster work with this...
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 13, 2005, 09:00:16 PM
Maybe you don't understand me..

I want to make one file for menu and one for banner, why?
because if i change something in one file, in all templates and all pages this info will be changed

What i must do, that site work good and fast?
Title: Re: include to the templates no problem in 1.7.1
Post by: V@no on August 14, 2005, 06:00:52 AM
u dont use echo, u should use include()
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 14, 2005, 04:24:26 PM
ok, thank's

at now i understand that i must do this:
Code: [Select]
<?php
include($_SERVER['DOCUMENT_ROOT']."/images/file.php");
?>

and only this
in templates...
Title: Re: include to the templates no problem in 1.7.1
Post by: V@no on August 14, 2005, 04:53:29 PM
http://us3.php.net/manual/en/function.include.php
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 14, 2005, 09:27:16 PM
if i understand right, need do that? :
Code: [Select]
<?php
include($_SERVER['DOCUMENT_ROOT']."http://www.mysite.com/images/file.php");
?>

but if i want place this template in other site, need replace all this....  bad idea
--- --- ---
my english bad :/
Title: Re: include to the templates no problem in 1.7.1
Post by: TheOracle on August 15, 2005, 01:47:07 PM
I still don't understand why you wish to add a PHP file inside your images path.

It should, rather, go like this :

Code: [Select]

<?php
include($_SERVER['DOCUMENT_ROOT']."/file.php");
?>



That's all there is . . .
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 15, 2005, 07:56:40 PM
Because this php is in images category, not in root(www.mysite.com)
Title: Re: include to the templates no problem in 1.7.1
Post by: TheOracle on August 15, 2005, 08:23:18 PM
So ... the question comes again : Why does it have to be specificly in the images folder ?
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 15, 2005, 08:30:56 PM
because this is from 4images peace of template, 4images installed to "images" dir
why i must cycle all site?

where 4images, there all files for 4images...
all templates use this php from "images" dir
Title: Re: include to the templates no problem in 1.7.1
Post by: TheOracle on August 15, 2005, 09:42:25 PM
Quote

all templates use this php from "images" dir


False. PHP files are being executed from - either - the root path of 4images or from a subfolder outside the template path. ;)
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 15, 2005, 10:11:58 PM
but.. how i must to do that?
there is all working with no problem..

www.mysite.com/images/ --> my site
www.mysite.com/images/templates/default/ --> my template

if i want include menu(menu.php) to the "home.html", "details.html", "top.html" and etc
what i must to do?

BIG thank's for the help, i new with PHP
Title: Re: include to the templates no problem in 1.7.1
Post by: TheOracle on August 15, 2005, 10:21:18 PM
Quote

if i want include menu(menu.php) to the "home.html", "details.html", "top.html" and etc
what i must to do?


All you need to do is to upload your menu.php file into your root folder of 4images. Then, from your HTML files, simply apply the following command on where you ' wish ' to add your included PHP file :

Code: [Select]

<?php

include($_SERVER['DOCUMENT_ROOT']."/menu.php");

?>



That easy . . .

and make sure you have the PHP execution code to 1 from your includes/constants.php file.
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 15, 2005, 10:24:42 PM
But.. i can write to menu.php only HTML codes? :)
Title: Re: include to the templates no problem in 1.7.1
Post by: TheOracle on August 15, 2005, 10:25:44 PM
No ... it's only for inclusion of the file ... nothing else.  :?
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 15, 2005, 10:31:37 PM
when i change to
<?php
 include($_SERVER['DOCUMENT_ROOT']."/menu.php");
 ?>

Quote
Warning: Failed opening 'C:/serv/www/menu.php' for inclusion (include_path='.;c:\php4\pear') in C:\serv\www\images\includes\template.php(133) : eval()'d code on line 106

Warning: Failed opening 'C:/serv/www/my_footer.php' for inclusion (include_path='.;c:\php4\pear') in C:\serv\www\images\includes\template.php(133) : eval()'d code on line 1158

with "images/menu.php" this works good
because in this file only HTML ? or what..
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 15, 2005, 10:36:58 PM
it's only for inclusion of the file ... nothing else.  :?
i can write this to the menu.php :
Quote
<?php
print "HTML codes";
?>
and all ok :) because this is php, yes?
Title: Re: include to the templates no problem in 1.7.1
Post by: TheOracle on August 15, 2005, 10:48:29 PM
That would not be the best choice but yes.
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 15, 2005, 10:57:43 PM
That would not be the best choice but yes.
maybe you know better choice for that?
Title: Re: include to the templates no problem in 1.7.1
Post by: TheOracle on August 15, 2005, 11:03:20 PM
Yes, it you intend to code on PHP language and planning to execute of part of it on your HTML templates, I'd - rather - recommend to initial some tags then parse your template from a PHP file (which is far more efficient and secured in this case).
Title: Re: include to the templates no problem in 1.7.1
Post by: ID25 on August 15, 2005, 11:17:42 PM
thank you for info