This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

2 sites integration
#1

Hello,

I correctly integrate a website into my installation of website.
But now I want to use my second site without installation.

How is it possible ?

I tried to integrate with iframe but I can not modify styles.

I tried to use with php : file_get_contents

But I do not know parameters.

Please help.
Reply
#2

Hi Ben,

The only way to integrate a second website is to use the iFrame integration.

You can modify the styles using the built-in CSS Editor module, but the styles will affect both your first website and second website, so choose a style that suits both if possible.

Have you completed the interview?
Reply
#3

Many thanks Steven.

Now, I have this error message : Error: Could not be loaded from the domain 'monglucko.com' 

What could I do ?

Is it possible to integrate a specific style after mini.style.css of commentics ?
Like : domain.com.css if file is present ?
Reply
#4

Hi Ben,

To fix that error you'll need to open the file /system/library/page.php and remove this line:
PHP Code:
<?php 
die('<b>Error:</b> Could not be loaded from the domain \'' . $this->security->encode($referrer) . '\'');

To have different stylesheets, first open the file /frontend/controller/common/header.php.

Then after this line:
PHP Code:
<?php 
$this
->data['commentics_url'] = $this->url->getCommenticsUrl();

Add this:
PHP Code:
<?php 
$this
->data['site_id'] = $this->page->getSiteId();

Then open the file /frontend/view/default/template/common/header.tpl.

At the bottom of the file add this:
Code:
@if site_id equals 0
  <link rel="stylesheet" type="text/css" href="stylesheet0.css">
@elseif site_id equals 1
  <link rel="stylesheet" type="text/css" href="stylesheet1.css">
@elseif site_id equals 2
  <link rel="stylesheet" type="text/css" href="stylesheet2.css">
@endif

And adjust as needed. If you go to Manage -> Sites and edit a site, you'll see the Site ID at the end of the URL in your web browser.

Have you completed the interview?
Reply
#5

Many thanks for your answers.
Reply
#6

(26-Jul-2023, 03:35 PM)Steven Wrote:  Hi Ben,

The only way to integrate a second website is to use the iFrame integration.

You can modify the styles using the built-in CSS Editor module, but the styles will affect both your first website and second website, so choose a style that suits both if possible.

I tried a different approach to supporting two sites.  At first I just tried to use it cross-origin, but then I found my permissions weren't allowing the server-side include done by the require statement.  So I put a separate instance of Commentix in each domain, but pointed them to the same database.  I saw no reason why they couldn't both share the same settings and data, if both sites were listed in Manage / Sites and there was no ambiguity between the page identifiers.  But it still doesn't work: site B renders resources from site A which then get blocked as cross-site, and when you hit the submit button it tries to post back to site A's instance, even though the form was rendered from site B.

My best guess is that which server it's requesting clientside resources from and posting the input back to must be controlled by the System settings.  Given this fact, I don't understand what the Sites list is even good for, but maybe it's useful for iframes.  I didn't want to use that approach but maybe it beats trying to synchronize the settings between two databases. Ideally, maybe the host site should be set in config.php like the database credentials, instead of within the database itself.
Reply
#7

I tried using iframe mode.  It did not help!  It still failed to either load resources or post the comment because site B was rendering references to site A inside the iframe. It renders the form but then you can't use it.  I gained nothing by creating two instances of the PHP code.

(Site A works fine.  It uses inline mode.)
Reply
#8

(07-Nov-2024, 03:11 AM)paulkienitz Wrote:  I tried using iframe mode.  It did not help!  It still failed to either load resources or post the comment because site B was rendering references to site A inside the iframe.  It renders the form but then you can't use it.  I gained nothing by creating two instances of the PHP code.

(Site A works fine.  It uses inline mode.)

 Maybe I can go back to one instance with allow-same-origin on the iframe?
Reply
#9

Okay, using a single instance with an iframe works. It's hosted on A, and site A has it inline while site B uses the iframe. Now I just have to edit a bunch of CSS to try to get the iframe version looking like the inline version.
Reply
#10

There is one distinct drawback to using an iframe from another host, besides the extra CSS editing I had to do: the cookie to prefill the name and email fields isn't working. Maybe I can tweak the iframe permissions or something.
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by nsuomine
20-Jan-2023, 08:32 AM
Last Post by Steven
23-Jan-2019, 02:07 PM

Forum Jump:


Users browsing this thread: 5 Guest(s)