Hello,
These methods are a bit of a "kludge" IMHO. For example; if your site offers online utilities that you have written in
PHP, Perl, or some other language, CMSMS won't handle your code very well when inserting it into the editor page.
Rendering it unusable. I struggled with this issue for quite some time, and finally discovered a much better way to
deal with this situation -
make a page that has
only your code in it (no , or tags). Then open the CMSMS editor on the
page you want to use it in and add the following:
Code: Select all
{php}include_once("your_utility.php");{/php}
You could also use
require_once(); if your utility is better served that way. Works pretty well (not so well with Perl
though).
I should also note that:
1) Pages with the
{php} {/php} tags should
not be editable by anyone you don't trust.
2) Enabling the
{php} {/php} tags on pages that are publicly editable
should be considered a
security risk.
3) The inclusion of the
{php} {/php} tags is not allowed by default. So you will need to enable it from
within your
config.php file, should you choose to use it.
Another solution that the PHP language has to offer that is superior to the methods that Calguy mentioned; is
the ability to read in a URI, and write it to your local file system. Which you can then include in a page on your
web site (CMSMS). This can easily be accomplished in the same fashion that I described above. You only
need to write a PHP script to fetch the URI > manipulate it (remove headers, and such) > write the manipulated
file > then open it (present it) in your page. This can all be done within one PHP script, which you can call this
way:
Code: Select all
{php}include_once("your_fetching_script.php");{/php}
Here's a "quickie" example of the PHP code you might use:
Code: Select all
<?php
// For PHP 5 and up
$handle = fopen("http://www.example.com/", "rb");
$contents = stream_get_contents($handle);
fclose($handle);
?>
This would read in the "home page" from
http://www.example.com.
However, this was only a quickie example. It
does not provide you any more information, than
how
to read in a file.
For many examples, and documentation, go to
php.net. Search the "function list" there for
fread,
fopen, or
fp. These searches will provide you
many examples that will make easy work of creating
your own
working script.
HTH
Chuck