Codeigniter Modules - php

I'm putting together a dashboard for a backend to a CMS project made with Codeigniter. There is some navigation in a sidebar and I"m trying to figure out what I need to know making "modules". I have two types of users. Administrators and basic users. They share the same sidebar navigation. Admins can see all links in the navigation and basic users can only see some. I was trying to look at a few different CMS's to see how they do it and really like how PyroCMS does it with putting together their navigation. However, I"m trying to find out what really tells me what I should makes a module. I know it has its own controllers, models, views and etc. I'm trying to find out with research what I need to know to really know what should I make into a module. Are their questions I should I should be asking myself that will be able to tell me what has the possibility of being a module and what isn't.
CMS Admin_Controller Line 80

Module development with PyroCMS is the way to go if you're used to working in CodeIgniter.
Becoming acclimated will be intuitive as a CI programmer, create a new module (drop it in your *addons/shared_addons/modules* folder):
https://github.com/pyrocms/sample
And notice how the routing works:
http://docs.pyrocms.com/2.2/manual/developers/basics/modular-routing
Then take a looksee at MY_Model (system/cms/core) that PyroCMS includes. I wrote a few modules before realizing PyroCMS includes a basic model that will save you from writing a lot of extraneous code. Don't worry, you can still always choose extend CI_Model instead if you don't want to use MY_Model for a module.
The more you learn about the mechanics of PyroCMS, the more you realize it has no limits. Unless you're writing trivial apps or just like re-writing code, I wouldn't start any new project in CI because PyroCMS is the more sensible starting point.
If there is something more advanced that the documentation doesn't answer for you. Then SNOOP AROUND! All the core features are built as modules. Check out how they did it in one of the core modules (system/cms/modules/). And if you want to change something in the core, you can avoid make any changes to the core by overloading views.
Once you're confident with your ported CI App, I would check out Streams. Streams will dramatically increase the time it takes to write trivial CRUD modules. If you're as happy as I've been with Pyro, you won't mind shelling out the lettuce to buy PyroCMS Pro or Streams.

Related

CodeIgniter - methodology for writing CMS?

I am building a CMS based on CodeIgniter and Wiredesigz HMVC plugin in order to expand my PHP and in particular OOP knowledge further. So, I have started, and am already stuck with two best practices issues that I hope someone can help with.
Should the core of my CMS, which will contain all globally used functions such as logging system events, load scripts and CSS for different modules, etc., reside in a library (that make calls to the Core module model) or in the Core module itself?
If I put the core functionality in a module, should my other modules extend the Core (class User extends Core) or should they be stand-alone (User constructor loads Core module)?
you may reference the CMS project pyrocms based on codeigniter framework
I have done more reading on this, but found no real concensus. Some comments said that it depends on what your end objective is. Since there are no other suggestions or answers here, I will consider it a personal choice.

How can I setup Yii Boilerplate?

I have seen lots of pages about Yii Boilerplate setup like: http://www.yiiframework.com/wiki/374/yiiboilerplate-setup-a-professional-project-structure-in-seconds/.
Is there any step by step instruction about creating a new basic YiiBoilerPlate app or maybe I am totally wrong about it!?!?!
Just build your app to fit your needs remembering to keep project specific files in separate folders, separate from base application components, like common extensions. I highly recommend using modules. You can have for example user management module with login, logout, profile etc. functionality, and depending on concrete project requirements just drop in more modules.
Mentioned boilerplate is more complex than standard Yii setup. There is one thing i really dont like, is that mudules are in both frontend and backend, and according to yii philosofy, module should be like mini application, so from this boilerplate seems that one should build separate mini apps for frontend and backend... But it is just a taste what you feel better.
If you are new i recommend standard setup, but using modules from beginning. Modules are something like mini app, which can operate on it's own. This way you can build your portfolio of modules, and then when doing some new project you can compose it much quicker and sturdier. A bit more tricki might be interoperability between modules, but thats a whole different story.
You should refer following article.
http://myprogrammingtut.blogspot.in/2013/04/step-by-step-setup-yiiboilerplate.html
which worked for me :)
Hope it'll help you.

Port Codeigniter App to PyroCMS

I'm working on a web application in Codeigniter. I'd like to integrate the functionality of my application with a CMS so that site admins can easily update the site (about pages, blog, etc). Is this easily done with PyroCMS or another Codeigniter-based CMS? Will I need to drastically restructure my existing app?
From my own experience integrating an app inside Expression Engine I can say that a CMS changes the way you usually work with CI. So be prepared to make some adjustments. Every CMS will come with it's perks and differences. It shouldn't be a big problem though.
If you want to use PyroCms take a look at this doc first:
http://www.pyrocms.com/docs/2.0/developers/creating-custom-modules
If you're looking for alternatives, there are a lot. It seems almost everyone working with CI has made it's own.
Here are a few:
http://www.ionizecms.com/
http://www.halogy.com/
http://codefight.org/
http://www.getfuelcms.com/
Also make sure you check out CI Bonfire, it's not a CMS but does help you when you start up a new project with a basic admin wrapper, which is sometimes more useful than a CMS:
http://cibonfire.com/
This was answered a year ago and answered well, but my support guy has forwarded me a few emails from users asking about this page.
When people talk about Content Management Systems they often suddenly get the idea of rigid backends where you applications have to follow specific rules. While PyroCMS certainly has a few conventions you are free to build your modules just like they are a CodeIgniter application, on the frontend or the backend.
If you want to use Models, Controllers, Views, REST API's, SOAP, whatever the hell, then you can do that.
But, we also offer some awesome tools to make building modules CRAZY-fast. Hate writing CRUD? Well don't bother. Using the Streams API you can leverage the build in "Custom Data" system we use to rock out chunks of interface for you.
Using PyroCMS for your application is certainly not "hacking it into a CMS", this is the exact use-case it was built for.
If you have an existing application, while you can't "put PyroCMS into your app" you can certainly convert your application to a module easy enough.
The simplest way of doing it is to write your models around the CMS' database. Host the CMS at a subdomain with authentication for your admins. (admin.mysite.com) or something and then use the same database to power your front-end for your site.
Is it the best approach? Probably not.
Will it work? Yes.
You will probably find it hard to expand vertically & add new features if you're relying on a 3rd party CMS for data entry & backend.

Modules in CakePHP

I am using this awesome framework during 6 months and I learnt a lot about it, but I wonder if it's possible to create an internal structure to simulate modules like in Codeigniter. I know there is the possibility to use plugins for that, but it seems too difficult to connect it together and pass info between them.
My goal is to get a joomla like modules, but how can i do that without changing the cakephp core? is that possible?
What I am doing for the project I have going on right now is to have the following
In my bootstrap.php
<?php
....
App::build( array(
'plugins' => array(
join( DS, array( null, 'Users', 'abryant', 'Sites', 'appName', 'tools' )),
),
...
));
?>
Then, I keep all of my utility plugins in the tools plugin folder. This is for plugins that you use as internal utilities that don't provide controller / action pairs. IE plugins for behaviors, components, stuff from github etc.
One of the plugins I always grab for my stuff is Eventful which allows you to handle event dispatching and receiving using event classes similar to controllers or models.
Then build a main AppController that has a corresponding AppControllerEvent class in the folder the instructions tell you to use. You can then keep your plugins folder clean for modules which provide controllers, views or some other direct user interaction.
You can use Eventful to broadcast events from plugins down to the App at the AppModel, or AppController sort of level. If you think about this carefully you can use an app level event to ask for responses from installed plugins and then cycle through a set of events to register blocks or inject information into the set view variables.
A lot opens up when you use events and think about how the events communicate with your app.
Well, you are right. Modules in Joomla are independent packages of code wich works like packages in linux (modules maybe depends on other modules), but all of them work over a core functionality. What I want to do is write a core over the CakePHP framework, wich includes the functionality to manage all kind of modules in the system, but I don't know what is the best way to modify CakePHP core to handle this situation...
I did this before with Codeigniter, and because of that I thought to come back to Codeigniter, but Cakephp helps me to create apps in less time... If it may be possible, it would be a great system.
Every module code should be inside its own directory, which includes a controller directory, models, views, config, etc... like a mini CakePHP app that extends the modified CakePHP core. I thought it can be done with plugins, but the way to interconnect them and pass info between them don't seem the best way to do it.
I hope you understand my explanation, sorry for my english.
Initially it seems very difficult, but I think it is the best solution for this problem.
Did you code plugins for all your modules? Or did you code the core in controllers, models, etc.. and extra modules inside plugins? It is weird to me to work this way in CakePHP.
I'll try to code all the modules apart, I mean a core plugin, settings plugin, modules plugin (to manage the other plugins), etc... And probably I'll use bootstraping.
Thank you very much for your answers and sorry for my bad explanation of my problem, but my idea was so general that I couldn't explain it better.

What is the proper way to develop a custom theme/template for Magento 1.4

I have recently started working on an eCommerce site for a company and they have selected Magento 1.4.0 to run their store. I have spent most of my PHP "career" working with various MVC frameworks (even Zend with Magento is supposed to be based on) but the complexity of Magento seems to be on another level with no seemingly good resources to look to for help.
Looking around the site I have seen suggestions for certain books to use as reference, but they all refer to Magento 1.2 or 1.3.
My goal is to develop for Magento in a way that I do not alter any of the base code so that the client can easily upgrade the version of Magento and just "drop in" my code and have it work. The current issue is how to properly use the layout/template breakdown correctly and how to add custom model/controller functionality to the application without hacking away at Magento's core code base.
how to properly use the layout/template breakdown correctly
What you need to know is the folder structure of the Magento & the use of its own MVC structure. This is a very very important part to get you started from the basic roots. Whatever version you use, the folder structure & the MVC structure followed by Magento will almost never change. Try to follow the Magento's own Knowledge Base & Wiki tutorials. If you want you can also follow some other sites as well.
how to add custom model/controller functionality to the application
without hacking away at Magento's core code base
You will need to use the custom module functionality to override the core code base of model / controller. It's a simple process of writing the main logic in a XML file, of what core class you want to override of Magento, in your module's "etc" folder. Try to understand the process first, from the Knowledge Base & Wiki tutorials, to get a firm grip on overriding core classes.
I hope this helps.

Categories