Help on Extension: EmbedPage

Im building an extension to embed another RoR app in Radiant. I followed
the
instructions at -
http://dev.radiantcms.org/radiant/wiki/HowToWriteAnExtension to generate
the
skeleton called M7Embed

The main file is: embed_extension.rb

class M7embedExtension < Radiant::Extension
version “1.0”
description “Allows you to embed other sites in Radiant”
url “”

def activate
EmbedPage
end

def deactivate
end

end

and a model embed_page.rb:

class EmbedPage < Page
tag ‘embed_page’ do |tag|
require ‘open-uri’

open(tag.attr['url']).read

end
end

The issue I am running into is that generally the application I am
trying to
load has relative references, and when it is embedded, it assumes
everything
is coming from the embedding page, and not the application… can anyone
suggest how to remedy this?

As an example of this code embedding google -
http://beta.method-seven.com/embed

Thanks in advance for your help,

Colin

P.s. - Credit to Joannou Ng for submitting a behavior to this list on
Jan
18th that was used as the basis for this extension.

Colin,

You might be better off with an IFRAME or something similar, otherwise
you will have to create a bunch of workarounds in your Rails application
to deal with a different HTTP_REFERER.

The other option, of course, is to fuse Radiant with your application,
i.e. making your application into an extension, but that may not be
appropriate.

Sean

Colin N. wrote:

The issue I am running into is that generally the application I am
trying to
load has relative references, and when it is embedded, it assumes
everything
is coming from the embedding page, and not the application… can anyone
suggest how to remedy this?

as an example:

You might have your Radiant at radiant.example.com, and
radiant.example.com/embeddedapp
calls
<r:embed_page=“myapptoembed.example.com”/>

And then the resultant page would have soemething like this
Login

But the problem if you then click “Login” your browser will go to

radiant.example.com/embeddedapp/login

when it should really be going to

myapptoembed.example.com/login

But the real problem you are going to have is when you Submit that login
form
And even it makes a POST to:

Now if all you want to do is make

myapptoembed.example.com

show up at

radiant.example.com/embeddedapp

All you really need is some Apache rewrite directives. Apache can
automatically convert each url as it comes in to the right back-end
url…

So, the question is… what are you REALLY trying to accomplish here?