1
iolai
Wrapping another page
  • 2004/9/9 10:25

  • iolai

  • Quite a regular

  • Posts: 206

  • Since: 2004/6/26


I don't want to use another module, but simply to wrap one page. I thought of doing it like this:

<?php
include("../../mainfile.php");
include(XOOPS_ROOT_PATH."/header.php");
$xoopsOption['show_rblock'] = 1;

include ("wrapped_page_url_here");

include(XOOPS_ROOT_PATH."/footer.php");
?>

But it isn't working...

Ideas why?

2
Stewdio
Re: Wrapping another page
  • 2004/9/9 10:46

  • Stewdio

  • Community Support Member

  • Posts: 1560

  • Since: 2003/5/7 1


You are very close, except for one thing. You need to replace

include ("wrapped_page_url_here");

with actual content, html tags and all. (Anything within the <body></body> areas of your code. Everything else is ignored)

Essentially, you do not use the include statement from php, you just copy and paste your code from the html page you want to include. You may have to change how a couple links work, like images and such, but I do this all the time with plain html pages, calandar scripts, guestbooks and even got Moveabale Type wrapped into XOOPS.

This is by far the easiest and fastest way to drop in content on the fly without having to build a module.

You may need to change the relative link of:
include("../../mainfile.php"); to something like:
include("/mainfile.php");

I have had to do this on occasion depending on the script I want to incorportate. Mainly I have only had to do this for anything in a subfolder of XOOPS. Pages in your root will not need to be adjusted with ../../ etc.

Proper experimentataion will get the results you need, depending on the root of your XOOPS installation and the location of your images and files.

Hope this helps.

3
iolai
Re: Wrapping another page
  • 2004/9/9 11:14

  • iolai

  • Quite a regular

  • Posts: 206

  • Since: 2004/6/26


Ok, so I understand I can embed only static content this way, and only content I have access to.

How can I embed dynamic content from other sites in it?

4
Stewdio
Re: Wrapping another page
  • 2004/9/9 11:41

  • Stewdio

  • Community Support Member

  • Posts: 1560

  • Since: 2003/5/7 1


You could use <IFrame> but you are limited i nhow it's displayed and it may not look all that great with your current design. That of course is just personal opinion.

As far as grabbing other dynamic content, you may need access to the code on the site you want to get content from and then you would have to build your own script to fetch it and display it on your pages within your own design. Thisis the harder way to do it, but gives you more creative freedom in terms of presentation and layout.

I achieved this on a semi-private site I did for someone where the list of members and their details are changed on a domain other then my own. The script I use fetches the user details as they are updated or changed, on the exteranal site then added or removed from the site I have this information displayed on. When their name is clicked on, user details from the external site are also displayed on a separate page controled by me, in a very customisable way. Unfortuanely, this code is limited to only the external sites functions and would be useless anywhere else, so sharing it would be futile. It relies on code developed for the external site and also incorporates information from their own database, which is not hosted on the site domain I have built the site upon. I would show you the link, but it's not intended for public consumption and is limited to members of this group.

I'm not sure if I over explained myself or not, but I think I may have complicated the matter some.

I also forgot to mention that you will need to save your file as .php, not .html

Your link would end up looking like http://www.yourdomain.com/customPage.php if you used the method explained and detailed in my earlier post. This could also be the reason why your page did not display. Generally, I just drop my html content into the XOOPS wrapper and worry about nothing else because this method is the fastest for me witout having to edit anything further. I also haven't tried using the include statement as you tried, so I have no knowledge on whether or not it will work, simply becaus e I never tried before.

I any case, here are a couple examples of what I have done wih the same wrapper you illustrusted:

http://www.stewdio.net/actd/about.php is just some html content with the XOOPS wrapper.

http://www.stewdio.net/guestbook is an entire 3rd party script I use. I simply edited the scripts code to output it's content in XOOPS. 3rd party scripts are touch and go, some work, some don't. Some need multiple pages wrapped in XOOPS, while others only need to have one file modified. It's truely experimental from a webmaster standpoint, but the results are outstanding when it works. I have done this successfully for over a dozen scripts.

As for <IFrame>, I don't like it because of the extra scroll bars and lack of control over how it is displayed. Again, not sure if thats what you wanted. I could be reading your defination of exeranl dynamic content wrong, so you will have to forgive me.


5
sikey
Re: Wrapping another page
  • 2004/9/9 12:15

  • sikey

  • Not too shy to talk

  • Posts: 151

  • Since: 2003/4/29


There "IS" a way... it makes use of the implode funtion in php and the calling of that file in a locally stored .shtml file...
So what it does, it retrieves the complete websitecode and includes it in the .shtml file...
When that .shtml file is viewed as source, you'll have the complete html of the remote website + your header and evenually scripts
I used to make a shitload of money with this... just remember, if doing this you could get busted as you're actually stealing content if it isn't yours in the first place...

6
iolai
Re: Wrapping another page
  • 2004/9/9 12:31

  • iolai

  • Quite a regular

  • Posts: 206

  • Since: 2004/6/26


Heh, nice.

Actually, it is my site, and it is located on the same machine, and I have access to both the sites. Problem is that I can't due to different restrictions use the same httpd, so I have 2 of them.

7
iolai
Re: Wrapping another page
  • 2004/9/9 20:04

  • iolai

  • Quite a regular

  • Posts: 206

  • Since: 2004/6/26


I limited my problem to reading a file from another website with php. I did it with javascript, now need to do it with php.

This is how I did it with javascript:
<SCRIPT LANGUAGE="Javascript" SRC="my_url_and_file_here"></SCRIPT>

The text file I am reading begins with 'document.write("' and ends with '");', so it basicly displays the content of the file on the page. But this is Javascript.

How can I do it with php?