开发者

How can I fetch the HTML contents of one single TYPO3 page into another CMS?

We need to display the content of one single TYPO3 page in Habari.

It would suffice to retrieve the HTML, as styling (CSS) is done separatly. How开发者_如何学Goever, we only want the HTML of the content elements - not the whole, fully rendered page.

  • How could we achieve that?
  • Does TYPO3 (or one of its plugins) provide a facility for that?


This can be done via a custom Typoscript template-record in the Typo3 backend that just outputs the content without any further HTML and or tags.

Putting something like this in the 'setup':

page = PAGE
page.config.disableAllHeaderCode = 1
page.10 < styles.content.get

Then make sure in the template-record it say's that it's a root-template, and that it clears constants and setup before this template. And put this record on the top most page (aka root).

Also make sure that you included the static template of CSS Styled Content. This can be done when editing the template-record inside Typo3.


You could do this in Habari using something like this:

$url = "http://your-typo3-url/";
$output = RemoteRequest::get_contents( $url );

$output will then be the HTML contents of the page. You can then use a combination of strpos() and substr() to pull the relevant HTML content you want, eg just the <body>

You can do this in one of your theme template files, the theme's theme.php file itself or even within a plugin.

You can then use Habari's native caching to cache the content too so you don't have to retrieve the Typo3 page with every page view.


BTW, You could use typo3_webservice fro that. It uses XMLRPC protocol, and quite easy to implement with PHP.

http://typo3.org/extensions/repository/view/typo3_webservice/current/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜