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

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
eflexer
Posts: 17
Joined: Thu 22. Jan 2004, 13:29

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

Post by eflexer »

{PHP: foo.php} works
{PHP: test/php} doesn't work

What´s wrong?

Ciao
Tom
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

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

Post 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}
eflexer
Posts: 17
Joined: Thu 22. Jan 2004, 13:29

Post 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
ionrock
Posts: 279
Joined: Fri 20. Feb 2004, 17:04

Post by ionrock »

You could try adding a slash at the beginning

{PHP: /sub/test.php}

who knows :)
eflexer
Posts: 17
Joined: Thu 22. Jan 2004, 13:29

Post by eflexer »

nope, doesn´t work :cry:
eflexer
Posts: 17
Joined: Thu 22. Jan 2004, 13:29

Solved

Post by eflexer »

Code: Select all

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

is working in this example :roll:
ionrock
Posts: 279
Joined: Fri 20. Feb 2004, 17:04

Post 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]
eflexer
Posts: 17
Joined: Thu 22. Jan 2004, 13:29

Post 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
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post 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/"
Post Reply