Hi,
I have this nice php guestbook that I want to use on my modx evo 106 website.
If I enter the direct url to the file newmsg.php in my webbrowser the guestbook page shows up
and everything is working.
http://localhost/zundapp/assets/guestbook/newmsg.php
If I use the following iFrame as content in the guestbook resource page:
<iframe allowtransparency="" frameborder="0" name="guestbook" src="assets/guestbook/newmsg.php" style="border:2px #0000FF solid;position:absolute;left:216px;top:147px;width:590px;height:755px;z-index:14"></iframe>
in modx, the guestbook page also shows up and everything is working.
So this must mean that both the absolute url in the webbrowser
and the relative path ="assets/guestbook/newmsg.php"
in the iFrame content are correct.
However when I try to use the same relative path in a snippet
<?php include ("assets/guestbook/newmsg.php"); ?>
as content on the guestbook resource page to call newmsg.php,
I get the following error :
PHP error debug
Error: require_once(./extension.ini) [function.require-once]: failed to open stream: No such file or directory
Error type/ Nr.: Warning - 2
File: C:\xampplite\htdocs\zundapp\assets\guestbook\newmsg.php
Line: 26
Line 26 source: require_once(GB_ROOT_DIR.'/extension.ini');
Ok,
GB_ROOT_DIR inside newmsg.php is set to "." define('GB_ROOT_DIR', '.');
and results in ./extension.ini which was working correctly in the browser url
and also with the iFrame.
If I chance GB_ROOT_DIR into this: define('GB_ROOT_DIR', 'assets/guestbook');
inside the newmsg.php page then the snippet call works and the guestbook page
shows up, but, all the links on the page are broken.
So,
Where does it go wrong with the snippet <?php include ("assets/guestbook/newmsg.php"); ?>
I think I should not have to change the relative path setting inside GB_ROOT_DIR
because it was working with the url in the browser and also with the iFrame content.
I guess I have to use a different relative path in the snippet call but I don't see how yet.
I don't want to enable allow_url_include as a work around in php.ini in the xamp server
as this raises the risk of code injection.
Thanks in advance
Brian.
[ed. note: sitecms last edited this post 14 years, 2 months ago.]