New block isn't recognized for installing

Permalink 1 user found helpful
Hi everybody,
I'm currently testing a new block (the facebook comments from the c5tutorials) and tried to add it to my site,
So i've put it at /opt/lampp/htdocs/concrete5.5.1/blocks/facebook_comment (where all the files are, gave them the 777 rights to be sure)
but when i login to my site to install it, it is not shown in the list of Awaiting Installation list in the Block Types panel of the Dashboard.

It has all the required files (add.php auto.js controller.php db.xml edit.php view.php) to work theorically (although i doubt it will)


Do you know what could I do to make concrete5 recognize it ?

When i tried the basic_test block it recognized it instantly

gloglo
 
cannonf700 replied on at Permalink Reply
cannonf700
Most likely this is not a block but a package. I would try moving it out of the blocks folder and into the packages folder and then see if you can install it from the dashboard.
Ekko replied on at Permalink Reply
Ekko
This isn't on topic, but I still am a little unsure to the relationship between blocks, and packages. I tried digging through the forums, but have only come up with the difference being that blocks are meant for less code, while packages is for larger bits.

I also understand that there stored in different directories, but looking at what goes into them they seem the exact same file wise.

Any light you could shed would be greatly appreciated.
jordanlev replied on at Permalink Reply
jordanlev
There are 3 different "universes" in the file structure of a concrete5 site. Each is a mirror image of the other:
1) your site directory (which contains "blocks", "controllers", "single_pages", "themes", etc. etc.)
2) The "concrete" directory (which contains "blocks", "controllers", "single_pages", "themes", etc. etc.)
3) Every package's directory (which *could* contain "blocks", "controllers", "single_pages", "themes", etc. etc. -- but unlike the first two, do not contain those things by default -- they must be added explicitly by the package author).

So a block is a specific kind of functionality in a C5 site (it's a thing that users can add to areas on a page and edit content with). A package is not specific functionality, but instead a way of distributing other functionality. It just so happens that many times, a package only contains 1 block in it... but there's nothing stopping it from containing 2 blocks or 10 blocks or no blocks (e.g. many themes), or a block and a theme and several single_pages (front-end and dashboard) mail templates and css and js files, and libraries and helpers (e.g. complicated applications that can be added to other sites).
gloglo replied on at Permalink Reply
gloglo
I've put a copy in the packages folder as well, changing 1 letter, and nothing happened :/
jordanlev replied on at Permalink Best Answer Reply
jordanlev
If it's not showing up in the list it's usually due to an error... usually the name of the block's controller class does not match up with the name of the block's folder. For example, if the block is:
facebook_comment
...then the controller class must be:
FacebookCommentBlockController

(NOT FaceBookCommentBlockController, and NOT facebook_comment_blockController, and not anything else... only exactly what I have above).

If that's not the case, maybe ensure that you have the db.xml file set up properly.
jordanlev replied on at Permalink Reply
jordanlev
By the way, putting this in a package versus keeping it in the site's "blocks" folder should make absolutely zero difference. It's best to keep it in the site's "blocks" folder if this is just something you're building for one site... things will be much more straightforward that way.
gloglo replied on at Permalink Reply
gloglo
This fixed it, the name in the controller was had an s (FacebookComments) while the name of the folder didn't.

Thanks a lot !