[solved]How to wrap external webpage ?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
aurels

[solved]How to wrap external webpage ?

Post by aurels »

Hi

I need to include an external webpage into a CMSMS content. How can i manage this ?
Thanks for help
Last edited by aurels on Sat Apr 05, 2008 12:10 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How to wrap external webpage ?

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
chuck
Forum Members
Forum Members
Posts: 23
Joined: Mon Mar 31, 2008 6:33 am

Re: How to wrap external webpage ?

Post 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

PHP 4-current
Apache-current
CMSMS-1.24
aurels

Re: How to wrap external webpage ?

Post 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...
chuck
Forum Members
Forum Members
Posts: 23
Joined: Mon Mar 31, 2008 6:33 am

Re: How to wrap external webpage ?

Post 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

PHP 4-current
Apache-current
CMSMS-1.24
aurels

Re: How to wrap external webpage ?

Post 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...
Attachments
ScreenShot001.jpg
chuck
Forum Members
Forum Members
Posts: 23
Joined: Mon Mar 31, 2008 6:33 am

Re: How to wrap external webpage ?

Post 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

PHP 4-current
Apache-current
CMSMS-1.24
aurels

Re: How to wrap external webpage ?

Post 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 ??
chuck
Forum Members
Forum Members
Posts: 23
Joined: Mon Mar 31, 2008 6:33 am

Re: How to wrap external webpage ?

Post 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

PHP 4-current
Apache-current
CMSMS-1.24
aurels

Re: How to wrap external webpage ?

Post by aurels »

Well...

It doesn't work anyway... :(
Do i need to install something or what ??
chuck
Forum Members
Forum Members
Posts: 23
Joined: Mon Mar 31, 2008 6:33 am

Re: How to wrap external webpage ?

Post 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

PHP 4-current
Apache-current
CMSMS-1.24
aurels

Re: How to wrap external webpage ?

Post by aurels »

Thanks a lot ! I effectively forgot to edit de Metadata form... Now it works !

Great thanks Chuck for your help !
Locked

Return to “CMSMS Core”