PHP include for Single Page
Permalink
Is there something similar to for Single Pages? I'm trying to do a PHP include.
I'm also fairly new to PHP/C5 so if there is a better way, I'm all ears.
Thanks in advance.
Josh
$this->getBlockPath()
I'm also fairly new to PHP/C5 so if there is a better way, I'm all ears.
Thanks in advance.
Josh
$this->inc('php filename');
It is used in themes and is a view property so it should work fine, although I haven't tested it so berate me mercilessly if it doesn't work ;)
Usually though most includes are usually methods better relegated to the controller and then a model. Totally depends on what you want to do though.
It is used in themes and is a view property so it should work fine, although I haven't tested it so berate me mercilessly if it doesn't work ;)
Usually though most includes are usually methods better relegated to the controller and then a model. Totally depends on what you want to do though.
php was started as a scripted language, thus it'll try to work on anything that you throw at it.
that said, if the php u're including is some sort of logic process (ie processing a form, etc) it should've been in the controller
that said, if the php u're including is some sort of logic process (ie processing a form, etc) it should've been in the controller
Good call on the logic. This was to share a view across add and edit, so I think I'm good.
Thanks again for all the help.
Thanks again for all the help.
I am trying to call a remote page with the script <?php include ("http://remote_url/page.html");?> and this does not work inside a C5 theme. Is there any code that will achieve the same effect?
brian that should work if its a remote site i believe
I get the following error message. It looks as if some adjustment must be made in libraries/3rdparty but I do not know what it might be. regards,
Brian
Brian
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /var/www/vhosts/holidexchange.com/httpdocs/nz/themes/intervac/default.php on line 543 Warning: include(http://www.intervac.com/templates/whatsnew_mini_04_en_GB.html) [function.include]: failed to open stream: no suitable wrapper could be found in /var/www/vhosts/holidexchange.com/httpdocs/nz/themes/intervac/default.php on line 543 Warning: include() [function.include]: Failed opening 'http://www.intervac.com/templates/whatsnew_mini_04_en_GB.html' for inclusion (include_path='.::/var/www/vhosts/holidexchange.com/httpdocs/nz/libraries/3rdparty:/var/www/vhosts/holidexchange.com/httpdocs/nz/concrete/config/../libraries/3rdparty') in /var/www/vhosts/holidexchange.com/httpdocs/nz/themes/intervac/default.php on line 543
do you have curl on your server?
The answer would appear to be yes. A <? phpinfo();?> search revealed that cURL was enabled with this information:
cURL Information: libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Brian
cURL Information: libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Brian
The very first line says that file access is disabled in the server configuration. You will need to enable access in php.ini. Generally, it is considered a security risk to include some random file from another server, because that file could be anything. If it is not treated carefully, the remote file could compromise the local system.
Would it work to create an IFRAME and let the user's browser retrieve the remote page directly rather than having the website retrieve the web page and pass it along to the user? That cuts out the middleman.
Would it work to create an IFRAME and let the user's browser retrieve the remote page directly rather than having the website retrieve the web page and pass it along to the user? That cuts out the middleman.
Thanks. A valuable answer. I had worked out that the problem was with PHP on my server as I had it upgraded to meet c5 5.3.3.1 requirements and I spent a fruitless 90 minutes on the telephone trying to get my VPS host to understand. The problem with an iframe is that the called up html has links and unless I can get the remote host to make them target=_blank it does not work. I finally found another script which is
<?php $file= "http://www.intervac-homeexchange.com/templates/whatsnew_mini_02_en_GB.html ";
if($data = file_get_contents($file)){
echo $data;
} else {
echo "No data to echo";
}?>
I feel I should pay you guys something for your time in giving this help. The link is not obvious on your site or are you 100% altruistic?
Regards,
Brian
<?php $file= "http://www.intervac-homeexchange.com/templates/whatsnew_mini_02_en_GB.html ";
if($data = file_get_contents($file)){
echo $data;
} else {
echo "No data to echo";
}?>
I feel I should pay you guys something for your time in giving this help. The link is not obvious on your site or are you 100% altruistic?
Regards,
Brian
Still not sure if this is preferred or not, but for now it's working.