Page 1 of 1

{PHP: foo.php} I am too stupid ?

Posted: Tue 16. Mar 2004, 14:13
by eflexer
{PHP: foo.php} works
{PHP: test/php} doesn't work

What´s wrong?

Ciao
Tom

Re: {PHP: foo.php} I am too stupid ?

Posted: Tue 16. Mar 2004, 14:27
by DeXXus
eflexer wrote:{PHP: foo.php} works
{PHP: test/php} doesn't work

What´s wrong?

Ciao
Tom
If you mean:

Code: Select all

{PHP: test/foo.php}
then "foo.php" must reside in:
$phpwcms["root"]/test/foo.php
example: {PHP:phpwcms/test/foo.php}

Posted: Tue 16. Mar 2004, 14:41
by eflexer
Yep, my root folder is "sub", my Replacement is

Code: Select all

{PHP: sub/test/index.php} 
and the error-message is

Code: Select all

Warning: include_ext_php( sub/test/index.php): failed to open stream: No such file or directory in C:\Inetpub\wwwroot\sub\include\inc_front\front.func.inc.php on line 955

Posted: Tue 16. Mar 2004, 15:27
by ionrock
You could try adding a slash at the beginning

{PHP: /sub/test.php}

who knows :)

Posted: Tue 16. Mar 2004, 15:31
by eflexer
nope, doesn´t work :cry:

Solved

Posted: Tue 16. Mar 2004, 15:37
by eflexer

Code: Select all

{PHP: ../../test/index.php}

is working in this example :roll:

Posted: Tue 16. Mar 2004, 17:14
by ionrock
if you look at your error code above there is a space
and the error-message is

Code:

Warning: include_ext_php( sub/test/index.php): failed to open stream: No such file or directory in C:\Inetpub\wwwroot\sub\include\inc_front\front.func.inc.php on line 955


so try making sure it is {PHP:myfile.php} where there is no space inbetween the : and filename. [/quote]

Posted: Tue 16. Mar 2004, 19:03
by eflexer
The space doesn't matter.

It works so

Code: Select all

{PHP:../../include/inc_ext/apps/intern/index.php}
or so

Code: Select all

{PHP: ../../include/inc_ext/apps/intern/index.php}
Only this

Code: Select all

{PHP:/sub/test/index.php}
doesn´t work, because it is rather a php include problem.

I am a php-newbie therefore it is need a little time to figure out.

If file A includes file B and file B wants to include file C and the files are in different directories there can be complications, because file B's include path automatically shifts to whatever file A's may be. A bit confusing to say the least.

A work around for this

Code: Select all

define("BASE", "path-to-root-project-directory");
then, at the top of every php page, before any other includes, include
path.php.

Then, before any include statements, use the BASE global.

Code: Select all

include "library.php" becomes:
include BASE."library.php"
Now you simply structure all includes to be relative to the project's base
directory, and every page will know how to get there.

Ciao

Tom

Posted: Wed 17. Mar 2004, 01:28
by DeXXus
eflexer wrote:Only this

Code: Select all

{PHP:/sub/test/index.php}
doesn´t work, because it is rather a php include problem.
This isn't "actually" quite true. If your file to "insert" is in:
C:/Inetpub/wwwroot/sub/test/index.php"
~and phpWCMS's file named "phpwcms.php" is in:
C:/Inetpub/wwwroot/sub/phpwcms.php"
then I "believe" you should enter:

Code: Select all

{PHP:sub/test/index.php}
~or~

Code: Select all

{PHP:../test/index.php}
In other words... "relative to the root folder that phpWCMS is installed in"
(The "called" file then "inherits" the URL path of the "calling" function, which in this case... is phpWCMS's root http://www.mydomain.com/sub/"