Module skeleton

Hi I am looking for some advice or tutorial how to create modules in PhalconPHP

something like this: http://www.yiiframework.com/doc/guide/1.1/en/basics.module

Could that be done via Phalcon and if yes where can I find the docs or tutorial.

Thanks.



9.2k

Could somebody also suggest some books on creating modules in general in PHP?



7.2k

Hi Module in PHP just is class Phalcon module sleleton is described in documentation very well. And are many example on Github Phalcon. You can also see my sleletonmulti on Github. https://github.com/oleg578/Phalconskeletonmulti I will be glad if this information will help you



9.2k

Thanks Oleg, but I need a separate directory for my module to store languages, config, views (both admin and frontend) so one file is not enough.

I need a similar structure to this: ```php modules/ posts controllers admin.php posts.php language english posts.php czech posts.php models postsmodel.php views admin/ postsaddpost.php postseditpost.php postslist_posts.php posts.php ```



9.2k

Hmm, I am looking at it right now and maybe it could be done like in your skeleton code. But your example is a little confusing. Because you have a module called "frontend". That's wrong approach, in my opinion, because when I develop a module I want to have in one location e.g. "forum" or "slider" the code for both admin area (backend) and for a frontend area. How to do that? In my example with "posts" (it's actually a working structure from CodeIgniter using HMVC) it's working like that. I have in a directory called modules all my parts of my website. How to do that in phalcon?



9.2k

Here is what I mean:

http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter

I am interested in the last approach but not in CodeIgniter (I have already done that) but in Phalcon. I don't need a fancy CMS to install modules. I just want to be able to copy the module from one project to another in total commander and copy or create the table for that module in my db if its necessary and I am read to go ;). Could somebody please explain to me and probably others who are interested in this kind of approach to modules how to do that in Phalcon. I really like how it works in CodeIgniter using HMVC approach and copying modules from project to project is very easy. Thanks in advance.



7.2k

That's even better, we can do this very simply in Falcon. This the tree of my work project ( I can not fully show ) ```php . ├── bundles │   ├── agencia │   │   ├── Agencia.php │   │   ├── controllers │   │   │   ├── Controller.php │   │   │   ├── _Controller.php │   │   │   └── Controller.php │   │   ├── models │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   └── s.php │   │   └── views │   │   ├── s │   │   │   ├── .phtml │   │   │   ├── .phtml │   │   │   ├── .phtml │   │   │   ├── .phtml │   │   │   └── .phtml │   │   ├── index.phtml │   │   ├── layouts │   │   │   └── main.phtml │   │   └── main │   │   ├── error404.phtml │   │   ├── failroute.phtml │   │   ├── index.phtml │   │   ├── mainpage.phtml │   │   ├── route404.phtml │   │   └── test.phtml │   ├── branch │   │   ├── controllers │   │   │   ├── _Controller.php │   │   │   ├── Controller.php │   │   │   └── UserController.php │   │   ├── Module.php │   │   └── views │   │   ├── actors │   │   │   ├── all.phtml │   │   │   ├── _.phtml │   │   │   ├── .phtml │   │   │   ├── persona.phtml │   │   │   └── .phtml │   │   ├── fail │   │   │   └── error404.phtml │   │   ├── index.phtml │   │   ├── layouts │   │   │   ├── main.phtml │   │   │   └── user.phtml │   │   └── user │   │   ├── goodbye.phtml │   │   └── signin.phtml │   ├── dashboard │   │   ├── controllers │   │   │   ├── Controller.php │   │   │   ├── Controller.php │   │   │   ├── Controller.php │   │   │   ├── Controller.php │   │   │   ├── Controller.php │   │   │   ├── Controller.php │   │   │   ├── Controller.php │   │   │   ├── Controller.php │   │   │   ├── Controller.php │   │   │   ├── UserController.php │   │   │   └── _Controller.php │   │   ├── Dashboard.php │   │   ├── models │   │   │   ├── s.php │   │   │   ├── _s.php │   │   │   ├── s.php │   │   │   ├── _s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   ├── s.php │   │   │   └── _s.php │   │   └── views │   │   ├── _s │   │   │   ├── edit.phtml │   │   │   ├── index.phtml │   │   │   └── new.phtml │   │   ├── _e │   │   │   ├── attachimage.phtml │   │   │   ├── edit.phtml │   │   │   ├── index.phtml │   │   │   └── new.phtml │   │   ├── index.phtml │   │   ├── layouts │   │   │   └── article.phtml │   │   ├── main │   │   │   ├── error404.phtml │   │   │   └── index.phtml.save │   │   ├── _ │   │   │   └── edit.phtml │   │   ├── _ │   │   │   ├── index.phtml │   │   │   └── setmain.phtml │   │   ├── _ │   │   │   └── edit.phtml │   │   ├── _ │   │   │   └── edit.phtml │   │   ├── │   │   │   └── edit.phtml │   │   ├── user │   │   │   └── edit.phtml │   │   └── __ │   │   └── index.phtml │   └── library │   ├── Aux.php │   ├── I18n.php │   └── Image.php ├── config │   ├── config.php │   └── i18n │   ├── de.php │   ├── en.php │   ├── fr.php │   ├── pl.php │   └── ru.php ├── public │   ├── 50x.html │   ├── assets │   │   ├── artimage │   │   │   ├── thumb │   │   │   └── web │   │   ├── css │   │   │   ├── awesome │   │   │   │   ├── css │   │   │   │   └── font │   │   │   ├── dashstyle.css │   │   │   ├── normalize.css │   │   │   ├── normalize.min.css │   │   │   └── style.css │   │   ├── fonts │   │   ├── img │   │   │   ├── icons │   │   ├── js │   │   │   ├── dropzone │   │   │   │   ├── css │   │   │   │   ├── dropzone.js │   │   │   │   └── images │   │   │   ├── jquery-2.0.3.min.js │   │   │   ├── production │   │   │   │   ├── ca11a1b000bb2b15c26.js │   │   │   │   └── final.js │   │   │   ├── scripts.js │   │   │   ├── tinymce │   │   │   └── video-js │   │   ├── photo │   │   │   ├── thumb │   │   │   └── web │   │   └── video │   │   ├── thumb │   ├── favicon.ico │   └── index.php ├── stamps │   └── wm.png

73 directories, 525 files

``` As you can see, everything is solved very simply Basis on my https://github.com/oleg578/Phalconskeletonmulti

P.S. Unfortunately, CI is already very outdated and can not optimally solve many tasks. To better understand what are the modules in Phalcon, look at the definition of bundles in Symfony2



9.2k

Thanks a lot Oleg, I will check it, it seems that it can be done with Phalcon too. I just need to study it more.



18.6k

Hi Oleg, how do you manage to you tinymce ? Do you use the plugins MoxieManager ?



7.2k

I used tinymce with standard install via MCE documantation. Without MoxieManager