Reputation: 51
This seems possible, but I'm missing something. I'm using plone.app.theming (diazo). I'm trying to pull in pages from a cold fusion site. I can get the first page to load using but the page then has urls that refer to more data pages. The urls are formatted like this "./undergraduates_classes_info.cfm?crse=001A§num=A" (which Plone is more than happy to parse) I've tried a variety of permutations to this and I can't seem to get it to work.
<xsl:param name="ExtUrl" select="'http://exeternalsite'" />
<xsl:template match="a/@href[contains(.,'/undergraduates')]">
<xsl:attribute name="href">
<xsl:value-of select="concat($ExtUrl, .)" />
</xsl:attribute>
</xsl:template>
I also need to pass the url to the command so that i can get the actual data back.
Any help is appreciate -- and maybe I'm approaching this incorrectly?
Upvotes: 3
Views: 408
Reputation: 2999
You can include content from an external site by specifying the href attribute as documented here: http://docs.diazo.org/en/latest/advanced.html#including-external-content
You will need to enable the "Read network" option in plone.app.theming to allow inclusion of external urls, see: http://pypi.python.org/pypi/plone.app.theming#usage
As others have pointed out, this does have a performance impact, but if you are caching the resulting pages that might be ok. You can avoid that performance cost by caching the fragment and using the SSI or ESI method options documented on the diazo site, but you will need to setup Nginx to run the filter.xsl stylesheet or a diazo proxy.
Upvotes: 2
Reputation: 3293
It's a very bad idea to depend on a remote service before you can finish processing the request. Imagine that site goes down or is slow? Now you're waiting on it to finish or timeout before you serve your page.
A better solution is to use javascript to pull in the contents of the page.
It could look something like this:
$(document).ready(function(){
$('#containerofcontent').load('http://remoteurl #contentselector');
});
Assuming your site is on a different domain, you'll also need to set some special headers on the remote site in order for browsers to allow the ajax request:
Access-Control-Allow-Origin: http://plonesiteurl
That's pretty easy to override headers with any web server though.
Upvotes: 2
Reputation: 2090
Unless I am misunderstanding your question (always possible), I think you are misunderstanding p.a.theming. p.a.theming can include theme assets (e.g. templates, images) from a remote site, but it is not intended for nor really capable of proxying in content from a remote site.
Upvotes: 0