So I had this posted under the add-on sections and I didn't get any replies in a month, so I hope do mind the repost here. Launching first site next week.
I am just getting started with Modx and I would like to have an external link in my website use my local template and have a local URL address.I am using Revo 2.2.4. and I have setup the external link as a resource with the Resource Type of Weblink and a Content Type of text. It currently returns the page with an external URL. I just need it to fit into the current template, in Joomla this is setting up a menu item as a wrapper. Im pretty sure my fruitless web searches are just a matter of different terminology and I just need to add a snippet or add-on. Any help would be appreciated.
Thanks Jonathan
-
☆ A M B ☆
- 24,524 Posts
So what you want to do is load the content of this external page into a MODx page? Or embed the external page?
Scottwell-
The external link is cold fusion script (listing a department directory) without a template, so to speak, around it so I just want to place the returned page into my site. So I guess I would like to load the external page into my template. The Joomla menu wrapper is the best example I have. Maybe it's a CMS linguistic translation problem.
-
☆ A M B ☆
- 24,524 Posts
Well, that would best be done either by AJAX or using an iframe.
-
☆ A M B ☆
- 3,141 Posts
You may just be looking for a quick PHP snippet like this:
if (!isset($url) || !empty($url)) { return 'No &url parameter passed.'; }
$content = file_get_contents($url);
return $content;
which you call in a regular document resource like this (assuming you named it getUrl):
[[getUrl? &url=`http://myurl.com/coldfusionscript`]]
-
☆ A M B ☆
- 24,524 Posts
This will only work if your PHP is configured to allow external sources for the file_get_contents() function. Many shared hosts have it disabled.
http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
Scottwell. Just needed to do a iframe. Worked perfectly. I will try Mark's suggestion later.
Thanks all for your assistance.