How to move blocks, manually, between different Concrete5 projects...

Permalink
I am working on several projects that are using Concrete5 at the same time and today I ventured to try and move a block that was useful from one project into the directories of another. Manually.

Quicker that way.

I also wanted to rename some of the existing blocks to reflect a better understanding on my part about what block was doing what (I am fanatical about proper and useful naming LOL).

So I copied the new block over to it's new directory home. But it doesn't show up inside the Dashboard.

As for renaming old blocks...

I did a dump of the database including drop statements, searched for the old block names (i.e. block handle/directory name) and changed them, and ran the revised sql on the database (which dropped the old tables and recreated them with my changes).

I then edited the controller file and change the class name to reflect the new block name.

And I edited the db.xml file to change the table name used to reflect the new name of the block.

Lastly I entered the Dashboard and Editing the old block that was still showing up in the Add Functionality dialog and I did a Refresh.

No errors were reported but...well...now the block disappeared LOL.

So I guess I am wondering what is left for me to do to bring the block back?

How do I register? a new block (which my renamed block has apparently become and which the new block I just copied is also)?

I mean manually? I guess I will settle for doing it through the Dashboard but it'd be nice to be able to do this quickly from outside the Dashboard if that's actually faster (by editing the MySQL directly or the block's files for example).

Any help or tips on this would be appreciated. I'd be happy to put together a tip sheet or otherwise on how to do this once I work out the kinks.

Thanks.

Carlos

 
carlos123 replied on at Permalink Reply
I figured it out!

There was a line in the controller file of the blocks that said...

protected $btTable = 'btDCPpaPhotoPagePhoto';


btDCPpaPhotoPagePhoto being the database table name (an example). I had left the old name in there and apparently the Dashboard was using that line to determine where the block details were at (or something like that I guess).

Anyway after changing that name to reflect the new name I went into the Dashboard and refreshed the old block name and voila!

Done.

Manually renaming a block and having it get recognized in the Dashboard. Sweet.

I'll have to play with this some more but I think that's it.

Carlos