I’m trying to include an external file into a webpage, much like a "Server Side Include" (SSI). The value is stored as a file in a template variable.
The value I have is:
assets/files/tables/mtel09.htm
using the following code
<?php
$testValues = explode(’,’,$options);
$path1 = $modx->config[’base_path’];
$path2 = $testValues[0];
$path = $path1 . $path2;
$result = $path;
return $result;
?>
I can generate:
/home/xxxxxxxxx/public_html/xxxx/assets/files/tables/mtel09.htm
on the webpage.
However trying to use:
$result = include_once($path);
This results in a collapse of the page and an error
PHP error debug
Error: include_once(/home/xxxxxxxxx/public_html/xxxx/<quickedit:eventHtmlTable />assets/files/tables/mtel09.htm) [function.include-once]: failed to open stream: No such file or directory
Error type/ Nr.: Warning - 2
File: /home/xxxxxxxxx/public_html/xxxx/manager/includes/document.parser.class.inc.php(769) : eval()’d code
Line: 6
and also any attempt on a variation of
$result = include_once(assets/files/tables/mtel09.htm);
or $result = include_once(/home/xxxxxxxxx/public_html/xxxx/assets/files/tables/mtel09.htm);
or $result = include_once(
http://website/xxxx/assets/files/tables/mtel09.htm);
doesn’t work either
So I want to know what is going on here. The above method is certainly the way I’d expect things to work.
Well actually that’s wrong, I’d expect to be able to link to a file value stored in modx without writing a snippet at all.
I’ve read many threads on similar things but none seem to have an explanation on how to do this.
The external file will be automatically updated by another program outside of Modx so can’t be a chunk.
Mark