Page 1 of 1

[solved]How to wrap external webpage ?

Posted: Mon Mar 31, 2008 3:08 pm
by aurels
Hi

I need to include an external webpage into a CMSMS content. How can i manage this ?
Thanks for help

Re: How to wrap external webpage ?

Posted: Mon Mar 31, 2008 3:53 pm
by calguy1000
go to http://smarty.php.net/manual/en and read about the {fetch} tag

or go to Extensions >> Tags and read about the {embed} tag.

Re: How to wrap external webpage ?

Posted: Thu Apr 03, 2008 8:31 am
by chuck
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


Re: How to wrap external webpage ?

Posted: Thu Apr 03, 2008 8:48 am
by aurels
Thanks both for your help.
Actually i should have precised : it only concerns an HTML external page with only one link to another HTML, that i would like to include..; SO i think the embed tag would fit enough for me... althought i really have NO idea about how to install/use this tag...

Re: How to wrap external webpage ?

Posted: Thu Apr 03, 2008 10:54 am
by chuck
Hello,
It's simple really...
1) Open the page that you want to embed the external URI in, in the CMSMS editor
2 ) Place the following in the editor (assuming you want to embed Google's home page)
{embed url=http://www.google.com/}

Or, if the path is more complex (longer). Insert the following (adjust as required).

{embed url=http://www.example.com/path/to/desired/page/page.html}

Need more information? Use Admin > Extensions > Tags

Scroll down till you see embed (on the left hand side). Look to the right, where you'll see Help, and
About. Click on Help to read all about the embed tag. :)

HTH

Chuck


Re: How to wrap external webpage ?

Posted: Thu Apr 03, 2008 12:00 pm
by aurels
Ok, so i simply paste the tag like this ?
But it does'nt work at all, i don't get any content on the preview...

Re: How to wrap external webpage ?

Posted: Thu Apr 03, 2008 12:18 pm
by chuck
Hello,
I'm afraid I can't see anything in the screenshot you've provided. When I click on it, it is still too small
to read. So I'm afraid I cannot advise you as to whether or not you've put the correct stuff in your page.
Can't you just type it in here as regular text?

Chuck


Re: How to wrap external webpage ?

Posted: Thu Apr 03, 2008 12:57 pm
by aurels
Sure

So, on the WYSIWYG editor, i just put {embed url=http://www.ai.univ-paris8.fr/~boyer/Sem ... index.html} like i'd type any text.

Did i miss something ??

Re: How to wrap external webpage ?

Posted: Thu Apr 03, 2008 1:09 pm
by chuck
Hello,
According to the embed documentation, you've done it exactly correct.
You did chhose > Apply, then Submit, after
entering the embed string in the editor, correct?

Other than that, I'm afraid I'm out of suggestions. Maybe some one else knows this one. :)

Best wishes, and good luck.

Chuck


Re: How to wrap external webpage ?

Posted: Fri Apr 04, 2008 8:20 am
by aurels
Well...

It doesn't work anyway... :(
Do i need to install something or what ??

Re: How to wrap external webpage ?

Posted: Sat Apr 05, 2008 12:44 am
by chuck
Hello,
I'm not sure if you read the whole documentation on this {embed} tag.
But, just to experiment for your sake. I made a page with it, and it worked flawlessly - albeit and iframe. ;)
Anyway, try the following:
On the Main tab of the page you're editing, insert the embed tag with your desired URI,
eg;
{embed url=http://www.example.com/index.html}

Now, in the same page, but on the Options tab, in the metedata section, insert the following:
{embed header=true}

Choose Apply, then Submit.

You're done.

Enjoy! :)

Chuck


Re: How to wrap external webpage ?

Posted: Sat Apr 05, 2008 12:09 pm
by aurels
Thanks a lot ! I effectively forgot to edit de Metadata form... Now it works !

Great thanks Chuck for your help !