[TYPO3-english] Embedding Remote Content into Typo3 CMS Page

Adam Retter adam.retter at googlemail.com
Tue Jun 28 11:47:41 CEST 2011


Firstly, thanks for the replies. My comments are inline below -

>> Within Typo3, when a specific page is loaded from the CMS -
>> I need to be able to make a Request to a remote URL, receive a HTML
>> document, extract parts of that document and embed them into the
>> returned page. I will also need to be able to insert parts of the
>> extracted document into the<head>  of the returned page. As Typo3 uses
>> a templating approach, it is not clear to me how to achieve this.
>
> Well, sounds like a pure javascript/ajax approach with manipulation the DOM
> with the received data afterwards. You could do this without
> configuring/extending TYPO3 at all. Just include a javascript file on the
> pages where you need it or extend an existing one.

I did attempt a pure JavaScript approach, but there were some issues with this -

1) Cross Site Scripting - the URL I am requesting is from a different
domain! This is problematic in older browsers. But none the less, it
can be done.

2) I could not get it to work correctly inside the TYPO3 page. I made
an example which uses a pure minimal HTML page -
view-source:http://kjc-ws2.kjc.uni-heidelberg.de:8600/exist/apps/test-embedd1.html

However when I reuse the JavaScript inside my TYPO3 page, I get
JavaScript errors, and I really cannot discern why, there seems to me
that there should be no difference. My TYPO3 page -
http://www.asia-europe.uni-heidelberg.de/index.php?id=1664

> There are other approaches, but if you are new to TYPO3 this seems to be the
> easiest one I think. The <head> data is normally defined within the
> Typoscript setup. You can insert specific non-standard code there with a
> userFunc. That userFunc calls a PHP class which generates the code you want
> to insert into the <head>. Google for "TYPO3 headerData userFunc" and you
> will get plenty of examples :)
>
> The HTML content from the remote site that you want to insert into the
> <body> of your page could be done with a userFunc as well or with an TYPO3
> extension that is inserted on the specific page as a plugin or included via
> Typoscript. This extension would load the remote site (curl or javasript)
> and insert the needed code into the DOM, so both require the remote page to
> be loaded first, which leeds again to the above approach with pure
> javascript I think.

So maybe I was not clear, I need to do 1 request to the remote site,
and from the returned content, extract some items that must be
inserted into the <head> of the page, and some items that must be
inserted into the body of the page. So two separate approaches wont
work, I need a single approach whereby I can manipulate the entire
page output from TYPO3. I agree that JavaScript (client side) would
seem like a good idea, but as I have written above, I cant get it to
work inside a TYPO3 page. Any ideas?


> There are often different ways to reach your goal in TYPO3 as you may have
> noticed, I don't thinnk there is a "best way" for your problem.
> I'd try the pure javascript approach since it may be the easiest for you.
>
>> Also, it appears that TypoScript does not seem to be a full-fledged
>> Server side programming language, or am I missing something? If not,
>> is there something else as well like server side JavaScript in Typo3?
>
> Typoscript ain't a "programming language" at all :)
> See: http://tinyurl.com/6gtegxg (What is Typoscript)

Ah right, So am I right in thinking that TYPO3, support call-outs to
PHP as the server-side language? If so, is there a mechanism in TYPO3,
for me to call a PHP script before the entire page is output from
TYPO3, and then somehow in PHP modify the DOM of that page, before
returning it to the web-browser?

> BTW: What do you mean with "server side javascript"?
> Javascript is always client side, as far as I know ;)

Nope, JavaScript is just a language. There are plenty of server side
implementations. In the CMS market, for example LiveLink CMS uses it
as their server side language. Also recently you might of heard of
node.js?

> greets,
> Markus
>
>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>



-- 
Adam Retter

skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk


More information about the TYPO3-english mailing list