Jump to content


Photo

2 sites, partly same content, different templates


  • Please log in to reply
10 replies to this topic

#1 vampke2

vampke2

    Etomite Forum Newbie

  • Member
  • 25 posts

Posted 13 April 2010 - 11:48 AM

Dear Peoples of Etomite,

I have 2 websites on different domains but on the same server. I can acces the same db from both domains.
For one section on both sites I would need to have the exact same content.
At the moment I just copy the whole page from 1 eto-installation to the other. I was wondering if there would be a more convenient method that would allow me to access the content from one installation directly from the other one.
Can this be done? How?

both sites have a different layout and use different templates

Edited by vampke2, 13 April 2010 - 11:48 AM.


#2 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 13 April 2010 - 12:18 PM

getExtTableRows() is the API function you want... I just finished a snippet for another member that pulls WordPress posts using this functin...

$etomite->getExtTableRows
(
$host="", 
$user="", 
$pass="", 
$dbase="", 
$fields="*", 
$from="", 
$where="", 
$sort="", 
$dir="ASC", 
$limit="", 
$push=true
)


#3 katherholt

katherholt

    Likes Etomite Forums!

  • Member
  • PipPip
  • 323 posts

Posted 13 April 2010 - 01:56 PM

Another option when your database is on a different server is to use 'php include' to call an external file.

In the file you want to call content - type in:
<?php include("http://www.yourdomai.../pagename.html"); ?>

I have to turn off the 'content editor' in the manager of the website I'm using php includes because the code disappears (or you could use a chunk and call that chunk into your page).

In 'miscellaneous settings' of your Etomite configuration you must use:
Allow Embedded PHP: 'Yes'

On the originating website file, I use a blank template and a hidden file with the content of the page I want by using: [[GetDocContent?id=xx]] and save the file. Then that file is the one I call via the php include.

I'm looking forward to using Ralph's code, but need to figure out how to call that into my page.

#4 vampke2

vampke2

    Etomite Forum Newbie

  • Member
  • 25 posts

Posted 13 April 2010 - 02:05 PM

getExtTableRows() is the API function you want...

Hi Ralph,

I know of the api's, I already used them for a couple of snippets I wrote.
Using this seems to be more complicated though than a simple copy/paste, or am I missing something?

a php include is not an option either, my hoster will not allow this.

Basically the question was if it would be feasible to have a setup that will automatically copy the entire section of site 1 in site 2 without having to add pages to both sites

#5 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 14 April 2010 - 12:56 PM

Perhaps, if I had a bit more detail of what you are looking to do, I could come up with a decent solution... As I mentioned, I just completed a snippet similar to NewsListing or ListDocuments that isn't tricky to use at all... Doing a site to site data synchronization just sounds like trouble waiting to happen... Feel free to contact me via PM or IM if you'd like a more timely discussion...

#6 PaulD

PaulD

    Likes Etomite Forums!

  • Developers
  • PipPip
  • 413 posts

Posted 15 April 2010 - 04:32 PM

Although I have not done this before, could you not use getExtTableRows to interrogate the relevant table on the 'other' eto site, and use the content it collects wherever you like on the second site. Thus you would not need to update both sites when a shared page is edited. Once you had the snippet working you would only need to pass the page id of the page content you wanted to the snippet.

Would that not work? I don't know if that helps at all.

Paul.

Edited by PaulD, 15 April 2010 - 04:33 PM.


#7 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 15 April 2010 - 09:21 PM

Yes, PaulD, you can connect to any MySQL database that is accessible from the internet... I have configured my server to be open in that past, although it hasn't been for a while now... If open, it would also allow for data synchronization scripting - but that's another story...

#8 vampke2

vampke2

    Etomite Forum Newbie

  • Member
  • 25 posts

Posted 16 April 2010 - 03:10 PM

clearly that would be a possibiliyy, but it would require more work than a simple copy/paste.
What I would like to have is a snippet that would output an entire section (page with all the children and subchildren) from my first site to the other without having to interfere anymore.
If I add a page to the section it would automagically show on site 2 without intervening.

Edited by vampke2, 16 April 2010 - 03:11 PM.


#9 PaulD

PaulD

    Likes Etomite Forums!

  • Developers
  • PipPip
  • 413 posts

Posted 16 April 2010 - 08:48 PM

I see what you mean. But your detailed intentions are not clear. I suppose the problem with what you are asking is that you might want to do many different things and each would have a slightly different solution.

It seems that you need a snippet on site one, that reads the content of site two, including all the children of a given page, and replicates it on site one. Of course the nature of your sites will play a factor in this, ie size and possible depths etc plus what you are actually trying to achieve with the data.

Now all the data you want is on the database of site two. Since you can read from any external table, you can read the table and pull the content of your first page, then run through a loop to collect all the first level children, then run again to get, if any, all the children of those pages etc etc as deep as you want it to go.

However I would not do this myself as it would involve too many database queries. As far as I know a single Etomite installation does not support multiple sites. Wordpress now does support multiple blogs for instance but the admin for it is a bit crappy and to be honest the multi site stuff is a bit limited. You can't just share data accross sites in a simple manner, you simply manage multiple blogs from one admin.

Can you give links to the two sites you want to link together, and some idea of where and how you want that data to appear?

Finally, a more simple approach might be to build a template that uses frames on both sites. Then one site could call a frame from the other site which might work and with careful design might appear totally seamless as well. (Although I would not use frames myself, there is no reason why you shouldn't use them. Google copes with frames quite easily.)

Hope that helps

Paul.

PS Having reread all the above, I don't think the snippet I described would achieve a page by page replication that would work on both sites as you described. I think what you are asking is very complicated to achieve and I can't help wondering what you are trying to achieve. Look forward to the sample links to see what you mean in more detail.

PPS FINALLY! Just as a warning, if you do manage to replicate the content, one or both of the sites will be penalised by google for duplicated content. This could make the whole exercise very counter productive.

Edited by PaulD, 16 April 2010 - 08:56 PM.


#10 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 17 April 2010 - 02:16 PM

Using getExtTableRows() is the way to go... It can be used to list external documents and display the content internally... Trust me, it works... I actually pulled that logic out of the snippet I mentioned above because that logic wasn't what the client wanted, so I know it works... All the client wanted was a list of recent WordPress posts with links to the original WrdPress pages... I originally had the code working entirely within Etomite...

#11 Ralph

Ralph

    Loves Etomite Forums!

  • Admin
  • 6,539 posts

Posted 26 April 2010 - 12:25 PM

Yes, RSS would be another option if you actually want a news feed and can tune it finely enough for your needs... The getExtTableRows() method uses less overhead and is simpler to implement, however, as you are dealing with raw data...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users