The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 100 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Mon Mar 08, 2010 8:12 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 21, 2008 12:25 am
Posts: 5
Hi,

Along with beanluc (and many other 5 star reviews on JED) I too recommend the JMS Multisites component, which works on very similar principles to this thread. The sql view methods described in this post, and the symbolic linking where required, is all taken care of via the component, and the provided tutorials/manuals make it all easy. The developer is top class and if you need customisations he's fast and effective.

I do like seeing threads like this though, it's great to see a way to create this situation yourself as it's a good way to learn. If I'd come across this thread before buying JMS I would probably be trying to do it myself too. But if you want a quick and complete solution which could potentially be up and running in less than an hour then JMS is more than worth the relatively low cost.

For my guesswork on the problem at hand, I'd say your options are either to remove the hash from both sites as you are trying to do, or alternatively maybe you could set up some php routine to check for newly created files, and copy them into the second location. Then trigger this routine every xx minutes with a cron job? It's not ideal, and I'm not saying I could help you much with the code myself as I've only just got to grips with basic cron myself but in theory it seems like it could be possible.

I hope you are successful in your project and resolve all your issues!


Top
 Profile  
 
PostPosted: Sat Mar 13, 2010 2:43 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 28, 2010 7:53 am
Posts: 16
Hi this is a fantastic thread, Thank you.

One problem I have is when I create the view tables, I get the caution on the phpMyadmin interface saying :-

"This view has more than 0 rows. Please refer to documentation. "

Any ideas why that is?


Deeno


Top
 Profile  
 
PostPosted: Sat Mar 13, 2010 8:03 am 
Joomla! Master
Joomla! Master

Joined: Mon Oct 27, 2008 9:27 pm
Posts: 13633
Location: Akershus, Norway
I have seen it also when opening views. It's a cosmetic error in phpmyadmin when it tries to count the number of records in the view.


Top
 Profile  
 
PostPosted: Sat Mar 13, 2010 11:13 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 07, 2009 10:27 am
Posts: 42
Location: Belgium
Hey all,

Since my hosting does not support symbolic links, JMS is out of the question for me (to share images n stuff). So I am currently working on a php cronjob that will check for new files and copy them to the other joomla sites (like Deeno described above ;-)).
I will keep you guys posted.

greets


Top
 Profile  
 
PostPosted: Sun Mar 14, 2010 3:00 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 21, 2008 12:25 am
Posts: 5
Hi tboheeren

I suggested the cron job :) so to follow up here is the php to do it:

Copy this code into a file called runme.php, then put the file into the directory that you wish to monitor.

Code:
<?php
// define these variables to suit your needs
$newdir = "../phpcron2/";       // the directory you want to copy the file to - relative to current directory
$interval = 1;                // this is how long your cron job is set to in minutes
// calculated variables
$currenttime = time();
$difference = $interval * 60;
$checkfor = $currenttime - $difference;
$currentdir = ".";
$dirarray = array();
$tobecopied = array();
// put the directory list into an array
$dir = dir($currentdir);
// read the directory
while($file = $dir->read()) {
   $uploadtime = filemtime($file);
   $dirarray[] = array($file, $uploadtime);
   }
$dir->close();
$arraynum = sizeof($dirarray);
$i = 0;
while($i < $arraynum) {
   $currentlist = $dirarray[$i];
   $currentfile = $currentlist[0];
   $filetime = $currentlist[1];
// remove roots that are picked up in the directory listing
   if ($currentfile != "." & $currentfile != "..") {
      // only add files that are within the defined timescale
      if ($filetime > $checkfor) {
         $tobecopied[] = array($currentfile);         
         }
      }
   $i = $i + 1;
}
// copy files from the $tobecopied array into the new directory
foreach ($tobecopied as $value) {   
   $file1 = $value[0];
   $file2 = $newdir . $value[0];
   if (!copy($file1, $file2)) {
      }
   }
?>



Whenever you run http://www.youdomain.com/yourdirectory/runme.php it does this:
1) gets the directory listing
2) checks for recently added files
3) copies the files into the new directory

You just need change the first two variables to suit your needs.
$newdir = the directory you want to copy to (relative to the current directory, including trailing slash)
$interval = how many minutes you have set your cron job to

Then you'll need to set up a cron job so it runs the runme.php file every $interval minutes.

This works on my server which is running php5. It needs more testing, for instance to see if it copes with a scenario where the file is already present.

It should be a good starting point for you though, hope it helps!


Top
 Profile  
 
PostPosted: Sun Mar 14, 2010 11:22 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 07, 2009 10:27 am
Posts: 42
Location: Belgium
Sorry pdschris that I thought somebody else made the suggestion, my bad!
Anyway thanks a thousand for this reply. I will go and test it today!

Great job!

greets


Top
 Profile  
 
PostPosted: Sun Mar 14, 2010 1:52 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 28, 2010 7:53 am
Posts: 16
The whole "views table" thing is a great wake up to me. They are a great way to create virtual tables. It seems that you can register on either of the Joomla sites and they both synchronise flawlessly. Why dose JFusion have problems with that?

I can almost see no problems with it so far. Has anyone used this to synchronize community builders table? What would be the issues.

Images/Avatars call for reference to the images/comprofiler/ folder in the comprofiler.php (in a few instances)

Would it work? if you changed the address to http://www.my_other_site.com/images/comprofiler in the comprofiler.php on the site with the view tables, so that site would just use the images stored on the the Master site, when showing the Avatars.

Not sure if it would work when registering new users on Site 2 and them adding a chosen avatar. I haven't time to try this yet. Anyone had any experience?

Am I making any sense ? :)


Top
 Profile  
 
PostPosted: Sun Mar 14, 2010 5:45 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 21, 2008 12:25 am
Posts: 5
Hi,

tboheeren - look forward to hearing if your tests are successful!

deeno888 - you make sense but that's the issue tboheeren has at the moment in the bottom half of page 1 on this thread. Your suggestion sound logical to me, though I think tboheeren has already tried something like that and had issues with hashes and hacking the CB files successfully.

I went down the JMS multisite route myself before finding this thread so I'm just here for the learning! The mysql view table thing is awesome though, major kudos to birnik for the explanation.


Top
 Profile  
 
PostPosted: Sun Mar 14, 2010 6:07 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Mar 04, 2009 9:50 am
Posts: 922
Location: Silicon Valley, CA, USA
Deeno888 wrote:
The whole "views table" thing is a great wake up to me. They are a great way to create virtual tables. It seems that you can register on either of the Joomla sites and they both synchronise flawlessly. Why dose JFusion have problems with that?

Because JFusion works with separate databases which each have their own tables. JFusion isn't aware of any View, which really is only one table even though it appears in 2 DB's. The concepts of mastery and slavery are blown to pieces when there aren't actually 2 separate physical data sets.

Think of it another way: If you installed two different replication routines on some system, each routine designed to replicate the same data/files/whatever kind of material, they would conflict with each other. So creating Views is like one kind of replication (in a way - it's actually virtual), and JFusion is another replicator. You don't want both at the same time.

Deeno888 wrote:
I can almost see no problems with it so far. Has anyone used this to synchronize community builders table? What would be the issues.

Used which, now? Views? It would work, I'm doing it with JomSocial.


Deeno888 wrote:
Images/Avatars call for reference to the images/comprofiler/ folder in the comprofiler.php (in a few instances)

Would it work? if you changed the address to http://www.my_other_site.com/images/comprofiler in the comprofiler.php on the site with the view tables, so that site would just use the images stored on the the Master site, when showing the Avatars.

I do this. But, not at the database level (that's where JomSocial stores the paths) nor by hacking PHP files.

I use ReReplacer, to re-write J! output before sending to the browser, using regular expressions. So, in the slave site which doesn't have a copy of the images, any IMG tags with SRC attributes which point to (let's say) ^/images/avatar/(.+)$ get re-writen to http;//master.site.com/images/avatar/\1

That just appends the domain of the master site so the image gets loaded from there. Let me say ReReplacer is AWESOME for doing things like this, see my comment about it
HERE
http://forum.joomla.org/viewtopic.php?f=428&t=213647&p=2055044#p2055044


Top
 Profile  
 
PostPosted: Mon Mar 15, 2010 12:59 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 28, 2010 7:53 am
Posts: 16
pdschris: Thanks again.

A big thanks to Birnik for their initial views demonstration and to tboheeren also for the continuation of the project with CB. I should have read it a bit further before my post but I have been so excited with the introduction to this views idea. I kinda got muddled.

On the other hand I want to keep the ball rolling and see what you all have come up with, to the full nitty gritty solution for Syncing the two (or more) sites using views.

Just a note to tboheeren: The reference you makes to Avatars uploading to site/components/images/comprofiler/ is not right, is it? That directory holds the default avatars but the uploaded ones go to root/images/comprofiler. Has that been already covered? Sorry if it has.

beanluc your a great help. Thanks. That ReReplacer looks great, I have to give that some looksee but for now I am going to work with the php code to see if my simple redirect on the slave site will work for Avatars. The bigger issue and one that I am sure may be solve in a similar way is when "we" ;) decide to expand our Communities to include some of the other features like galleries etc.

tboheeren, what do you think? Change the link location in the comprofiler.php on the slave site to point to the directory on the master? Seems the simplest solution and if works, it would work at many other levels. The only issue might be if the slave site could ad and amend avatars? It might need some editing to the code in the community builder php files on the slave.

Deeno

EDIT:
beanluc, I had a look at that ReReplacer, great concept a bit like built in Firebug viewer. But it's not for me. If I have to go to the trouble of finding the code to replace, I would like it to be permanent. It's great for testing out theories before setting them to stone, I guess?


Top
 Profile  
 
PostPosted: Mon Mar 15, 2010 2:14 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 28, 2010 7:53 am
Posts: 16
Just a quick note: I just noticed that when I make all the "view" comprofiler_tables I get no trouble with users editing avatars, so long as they are the default ones in the community builders list (Duck, Ball etc). It's only the modified/added avatars that only show up on the "site where added"

I have more comprofiler_Table than tboheeren mentioned in his post but maybe because of further added components.

Will look now at the php edit and let you know.

EDIT

No, doesn't work by just changing the /images/comprofiler/ location in the slave comprofiler.php I get an error. :-\


Top
 Profile  
 
PostPosted: Tue Mar 16, 2010 12:16 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 28, 2010 7:53 am
Posts: 16
Would some one have any tips or links to other forums/developer pages that might discuss this subject in more detail?

Using Views to integrate multiple sites is definitely the way to go but the word "views" is a stupid choice of names. It's too ambiguous. Searching for views tables in any forum or search engine gives you anything from viewing a table to a nice art deco piece of furniture. They might as well have called them "dining" rather than "views" it would yield the same useless replies. Why not virtual tables? or remote tables? grrrr.

Any way any links that you might have found that have helped you would be great.

Thanks

Deeno


Top
 Profile  
 
PostPosted: Tue Mar 16, 2010 2:55 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Mar 04, 2009 9:50 am
Posts: 922
Location: Silicon Valley, CA, USA
add "MySQL" to your search queries about table views.


Top
 Profile  
 
PostPosted: Mon Mar 22, 2010 9:06 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 12, 2009 4:59 pm
Posts: 34
Being here and there lately, so I missed the thread a bit. Nice to see the solution evolved and now can be used for multiply extensions.

reReplacer could be a very good solution for avatars (and generally for any type of files problems). It may need some shifts for this and that, but however could work out.

_________________
Birnik


Top
 Profile  
 
PostPosted: Tue Mar 23, 2010 5:06 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Apr 10, 2006 10:26 pm
Posts: 214
Location: UK
So, can I get a bit of help on this one? Regarding databases

How do you get the same database username over 2 domains?

_________________
Please read forum rules regarding the use of signatures: viewtopic.php?f=8&t=65


Top
 Profile  
 
PostPosted: Wed Mar 24, 2010 9:21 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 12, 2009 4:59 pm
Posts: 34
RJP wrote:
So, can I get a bit of help on this one? Regarding databases

How do you get the same database username over 2 domains?

You can use the method above if both domains are on the same server (and use same mysql user)

_________________
Birnik


Top
 Profile  
 
PostPosted: Wed Mar 24, 2010 11:21 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Apr 10, 2006 10:26 pm
Posts: 214
Location: UK
I presume that if all the databases are together, the actual Joomla intallations can be hosted on separate servers with remote database access?


Top
 Profile  
 
PostPosted: Wed Mar 24, 2010 12:32 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Mar 04, 2009 9:50 am
Posts: 922
Location: Silicon Valley, CA, USA
Generally, yes,

However, if you're considering the MultiSites (JMS) extension, be aware that it won't do this for you, you would have to manually re-create or move a slave website and its settings.

Otherwise, no reason you couldn't have a separate database server box and separate J! website boxs.


Top
 Profile  
 
PostPosted: Wed Mar 24, 2010 1:04 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Apr 10, 2006 10:26 pm
Posts: 214
Location: UK
Cool, thanks guys. I quickly realised the multisite components wouldn't easily cut it for my purpose...

Cheers again, RJP1


Top
 Profile  
 
PostPosted: Thu Mar 25, 2010 9:12 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 12, 2009 4:59 pm
Posts: 34
beanluc wrote:
Generally, yes,

However, if you're considering the MultiSites (JMS) extension, be aware that it won't do this for you, you would have to manually re-create or move a slave website and its settings.

Otherwise, no reason you couldn't have a separate database server box and separate J! website boxs.

Please stop hijacking the thread with advertising of commercial extensions.

_________________
Birnik


Top
 Profile  
 
PostPosted: Thu Mar 25, 2010 11:49 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Mar 04, 2009 9:50 am
Posts: 922
Location: Silicon Valley, CA, USA
birnik wrote:
Please stop hijacking the thread with advertising of commercial extensions.

Birnik.

I would hardly say I'm "advertising" something, by warning someone that it won't work in his situation. :D

What's more, the extension in question has been discussed, on-topic, in this thread since a whole month before you joined the thread, and two months before I myself mentioned it - again, on-topic. :-\

Third, the right way to express a concern like that is to report the post you're concerned about, not to hijack the thread with off-topic criticism. :eek:

Fourth, this is a public forum, not a representation of OSM, or JED, or the Joomla project. There are good reasons for not listing un-free (libre) products in the JED. There's no good reason, and no policy requiring, to not discuss paid, gratis, libre, unfree or any kind of extension here, especially when it's precisely on-topic (hardly a hijacking). :geek:

Fifth and finally, "commercial" (un-free price, non-gratis) never was a criterion for barring extensions from JED. "Proprietary" (un-free license, non-libre) was. You don't appear to know this, Birnik, but JMS Joomla MultiSites is GPL. That's the very definition of free software. ;D

Back to the regular topic... :pop 8) :pop ??? :pop :) :pop


Top
 Profile  
 
PostPosted: Thu Apr 01, 2010 9:17 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 28, 2010 7:53 am
Posts: 16
Lets keep this nice guys and girls

With my respect to beanluc (who has been a great help), I really don't want to hear any further JMS stuff either as it doesn't add anything to this particular solution and as far as I can see it's a pay solution that does what we are discussing doing, with a little creativity, for free.

This thread is a fascination insight to those that want to solve it themselves. There are after all loads of forums for JMS and similar.

I am however, fascinated to hear what solutions any of you might have had in sharing the image folders across multiple sites? So far my efforts have come to Naught :(

Anyone wanting to work out how to use VIEW Tables to merge users on multiple sites READ THE THREAD on page 1 & 2 it's a great read and solves so many multi site issues. With it you can share any module Data, by dropping the table on the slave site and replacing with views. I have used it for Articles, Polls, Image Galleries (Less the images) :) :)

And that's where I would like the discussion to go if any of you can comment on your successes with image/avatar sharing.

Deeno


Top
 Profile  
 
PostPosted: Thu Apr 08, 2010 5:30 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 12, 2009 4:59 pm
Posts: 34
Using symlinks should do the trick if you are on linux with apache.

_________________
Birnik


Top
 Profile  
 
PostPosted: Tue Apr 13, 2010 12:57 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 07, 2009 10:27 am
Posts: 42
Location: Belgium
I am close to a php solution that avoids symlinks and that can still sync the avatars between sites. I will keep you guys posted as soon as it is finished.
ps: the solution will be as descibed in the thread, a cronjob.


Top
 Profile  
 
PostPosted: Thu Apr 15, 2010 8:23 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 28, 2010 7:53 am
Posts: 16
Thanks TB ;)


Top
 Profile  
 
PostPosted: Wed Apr 21, 2010 7:01 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Apr 21, 2010 6:52 am
Posts: 2
Thanks guys. That answered my problem, but i have a new one: i cannot register new users on site2. Did i do something wrong?


Top
 Profile  
 
PostPosted: Wed Apr 21, 2010 7:17 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 07, 2009 10:27 am
Posts: 42
Location: Belgium
That should be possible yes porc.
What exactly is the error?
If you followed the steps as described in this thread you should not have these problems.


Top
 Profile  
 
PostPosted: Wed Apr 21, 2010 7:40 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Apr 21, 2010 6:52 am
Posts: 2
Oh, my bad. It seems i cannot use the same email adress for a new user. And because i gave me no error message but only looked as nothing happens when i press register i thought it was a database issue. Tested now and it works.
Thanks anyway man. Do you gave any ideea how can i make an email chek or error work? I'm totally in the dark here


Top
 Profile  
 
PostPosted: Wed Apr 21, 2010 7:52 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 07, 2009 10:27 am
Posts: 42
Location: Belgium
Normally if you have an email adress in use you should see the error 'that email adress is already in use' when you try to register. It could be possible that this is an extra setting in communitybuilder global configuration. It is better that you ask this in a forum dedicated to CB.


Top
 Profile  
 
PostPosted: Wed Apr 21, 2010 1:32 pm 
Joomla! Master
Joomla! Master

Joined: Mon Oct 27, 2008 9:27 pm
Posts: 13633
Location: Akershus, Norway
The error message is displayed in the message field. Your template may be missing the <jdoc:include type="message" /> so messages are not displayed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 100 posts ]  Go to page Previous  1, 2, 3, 4  Next



Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group