How can I install the same component twice?

This forum is for general questions about extensions for Joomla! version 1.5.x.

Moderator: General Support Moderators

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.
Locked
User avatar
cre8tivemedia
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Fri Feb 08, 2008 9:19 pm
Location: U.S.A.
Contact:

How can I install the same component twice?

Post by cre8tivemedia » Sun Jun 06, 2010 4:37 pm

I am using a portfolio component that I would like to be able to set different parameters on for separate areas of my site. The component will only allow one setting throughout the site and I can't seem to get around it. I figured I might try installing a second instance of the component to allow me to have different settings for each. This way I could treat them as two different components.

Does anyone know what I would need to change in the original zip file so I can install it into Joomla as a separate component? Is it simply changing file and folder names or would I have to dig even deeper into individual files?

Thanks,
Matt

mrPilsener
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Sun Jan 31, 2010 12:25 pm

Re: How can I install the same component twice?

Post by mrPilsener » Sun Jun 06, 2010 6:51 pm

The jos_components table of the db determines what you can configure in the back-end so if you manually added a new record, you could make a new component appear that referenced a single front-end component but any changes made to one of them would affect the front end in the same way! You might need to create duplicate tables for each of the tables installed by the original component. Then you would need to make sure that all of the SQL queries executed by the component made changes to the new duplicate table and that the Jtable function i n the backend referenced this table. This should be possible to do using find/replace without too much trouble. Finally, of course you'd need to create an extra menu item for the new duplicate component.

There might be an easier way than this, but that's how I'd try it.

User avatar
cre8tivemedia
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Fri Feb 08, 2008 9:19 pm
Location: U.S.A.
Contact:

Re: How can I install the same component twice?

Post by cre8tivemedia » Sun Jun 06, 2010 10:23 pm

Thanks for the advice mrPilsener. I was hoping to avoid having to create new tables in the database because I am not versed in editing the SQL. I took a look at the db using phpMyAdmin and I can see the component in the jos_components table. I'm just a little overwhelmed never having dealt with this before. Can I export the data from the component and then import it with a different name or would I have to manually type in a new record?

I figured maybe trying to edit the install files would allow Joomla to do the work of setting up the tables for me as a new component. I just don't know where to begin with that. Maybe it is easier for me to look at some tutorials on how to use phpMyAdmin and give that a whirl? If you know of anywhere you can point me to explain a little better that would be appreciated.

User avatar
cre8tivemedia
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Fri Feb 08, 2008 9:19 pm
Location: U.S.A.
Contact:

Re: How can I install the same component twice?

Post by cre8tivemedia » Wed Jun 23, 2010 5:42 pm

Figured it out 8)

I simply replaced the component name along with associated filenames in the original zip file. I'll try to explain.....

I downloaded the original component, in this case I am using a portfolio component, then extracted the zip file. Found out the name used in Joomla for the component which happens to be "com_portfolio".

So, I used a tool called find & replace which will look through a specified directory for any specific text that you ask it to (do a Google search, there are tons of these free tools). Had it look through all the files in the downloaded zip file (after it was extracted) and find the word "portfolio" and replaced it with "portfolio2". This changed every instance of the word portfolio in every file.

Then I did a search for all folders and filenames which include "portfolio" in the same directory ( in Windows you can do this with the search tool in the Start Menu). Modified each file that had the word "portfolio" to "portfolio2". This means all the files that include the word portfolio - "admin.portfolio.html" would now be "admin.portfolio2.html" for example and folders like "com_portfolio" would now be "com_portfolio2".

After changing the folders and filenames I created a new zip file with the main folder, this is the top level of the extracted zip file which should have the same name as the original zip file that was downloaded. Installed this file as a new component in Joomla and so far has worked flawlessly as a completely new component.

By doing it this way, Joomla sees the new zip file as a completely different component than the original and it takes care of writing the data in the DB for you but doesn't mess up the original DB. Obviously you should try this on a dummy site before trying on a live site because there may be something different in the specific component that you are using that may need some tweaking. Oh yeah, make sure to back up your site before trying any of this. My first couple of tries had undesireable results until I figured out what I was doing.

Best of luck,
Matt

mrPilsener
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Sun Jan 31, 2010 12:25 pm

Re: How can I install the same component twice?

Post by mrPilsener » Wed Jun 23, 2010 10:39 pm

Well done. Sorry I couldn't be any more use and glad you got there on your own!

User avatar
cre8tivemedia
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Fri Feb 08, 2008 9:19 pm
Location: U.S.A.
Contact:

Re: How can I install the same component twice?

Post by cre8tivemedia » Wed Jun 23, 2010 10:54 pm

On the contrary mrPilsener, your suggestions made me think about the DB a little more which led me to editing the files the way I did. It was a good learning exercise, I feel like I'm understanding more and more about how Joomla works behind the scenes. Thanks again for your help.


Locked

Return to “Extensions for Joomla! 1.5”