4 posts by 4 authors in: Forums > CMS Builder
Last Post: October 22, 2012   (RSS)

Hi Support
I was wondering whether it's possible to share data across two URLs, as almost all of the content is the same across the two sites, with only a different logo and different footer.

Otherwise, do you have any suggestions so my client doesn't need to maintain two separate sites?

Thanks

Re: [degreesnorth] Is it possible to share data across two URLs

Hi,

Are the sites on the same server?

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [degreesnorth] Is it possible to share data across two URLs

Hi,

There are a few ways you can do this. If the sites are on the same server you could use one copy of CMS Builder. You would just have to ensure that the CMS Builder was installed at a path that both sites could access.

If the sites are on separate servers you could use PHP Curl do get the html data from one to another and display it:

// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// grab URL and pass it to the browser
$html = curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);


The limitations here are that not all servers come with the Curl functions installed, and that getting dynamic data (for example submitting a form or sorting a list page) are made more difficult than normal.


The final method is to use Javascript, as some browsers don't support cross domain use of AJAX you could look into JSONP. You could create a dynamic javascript object that contains the page data one one site, then load it on the second and use Jquery to display it on the page. This post explains how it works:


http://stackoverflow.com/questions/2067472/please-explain-jsonp?answertab=active#tab-top


Thanks!
Greg Thomas
PHP Programmer - interactivetools.com