CodeIgniter Forums

Full Version: Help for building simple CMS with codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]strogg[/eluser]
Hi all,

I have moderate native PHP programming knowledge, never used any framework before, just some template engines used for my projects. Now I'm learning Codeigniter these days, I tested several frameworks, Codeigniter very nice framework, and I'll study documantation.

So I need help for building simple cms system, on Backend simple CRUD structure for creating, reading, deleting, updating pages, and setting page types (front, gallery, form etc.) and custom templating. Finally a Frontend.

I decied to build with Codeigniter, any tips and ideas ?

Thanks

El Forum

[eluser]mrahman[/eluser]
yes you've made a good dicision. read the user guide http://ellislab.com/codeigniter/user-guide/ and search these forums and you will have extensive help. there is a video tutorial also. that's what i did so far and CI is perfect at my site (the apache one). thanks to CodeIgniter.

El Forum

[eluser]Chris Newton[/eluser]
Tips / ideas.

1. Create a view named something like 'page.php' and put

Code:
$this->load->view('layout/header');
$this->load->view('content_'.$page);
$this->load->view('layout/footer');

Then you can call it like;

Code:
$data['page']="my_content";
$this->load->view('admin/admin_page',$data);

Then you can have 1 view that calls subviews based on the 'page' you set, making it easier to maintain consistent headers & footers without having to call them individually every time.

2. learn about uri_to_assoc(); I prefer to use name/variable pairs when passing URLs than segments (sometimes you don't need to pass every segment)

El Forum

[eluser]esra[/eluser]
If you want to break up your code into separate modules like a true portal-like CMS, read the wiki article called Modular Separation and the associated forum thread. The Modular Separation extensions works extremely well when used in conjunction with Coolfactor's proposed View library for CodeIgniter.

El Forum

[eluser]strogg[/eluser]
Thanks for replies.

@mahuti

1. I created page.php as controller, I'm getting table data for $data then,
$data['page']= $this->db->get('content');

and then I passed to view
$this->load->view('front',$data);

On your example ; $page is a file ? or query made data ? I'm trying to get all necessary data from MySQL.

2. I'm checking about uri_to_assoc(); i'm not familiar this.


@esra Modular Separation makes more sense about modular portal-like design, any usage example you have?

El Forum

[eluser]esra[/eluser]
[quote author="strogg" date="1195396363"]@esra Modular Separation makes more sense about modular portal-like design, any usage example you have?[/quote]

In the past, there were no module submission guidelines. Various people were using different view schemes, different validation classes, etc. Zacharias has a user guide coming in the next release with guidelines for submitting modules. An svn site is also being set up for storing module submissions as well as the latest Modular Separation code. Afterwards, you should start to see module submissions as well as sample applications.

Because of changes to the directory structure in Modular Separation (now known as Matchbox) v2.4.1 and upcoming changes in the next release, a Matchbox module will effectively be an application which could have submodules. Each module can have directories for its own libraries, helpers, plugins, language files and configuration files. Each module can have one or more controllers and associated models and views.

I will be releasing a sample application based on Modular Separation, Coolfactor's View library and a GUI-like toolkit for wrapping the EXT JS libraries. It will be possible to create GridViews, EditViews, FormViews, TreeViews, AccordianViews, etc. which can be mixed and matched within Window-like templates. It's based on the EXT JS 2.0 Desktop sample application. Modules will be running in their own windows which can be minimized, maximized, resized, repositioned, etc. I do have CMS modules but store content centrally in a single table and use additional tables based on Joe Celko nested sets for creating separate hierarchial trees for blogs, content (articles/news), faqs, help, etc. From a feature standpoint, the CMS modules are equivalent to the Joomla core CMS components. However, the CMS modules are much more extensible and feature better encapsulation.

El Forum

[eluser]Chris Newton[/eluser]
I use $data['page'] to store the name (or in this case just a part of the name) of a view, so in the case of my example;

content_my_content.php

would be a view name that gets loaded into a generic view template called page.php that contains links to all of the headers & footers needed for the particular controller. So, I was talking about creating a generic view template that calls in at least one, more specific view. So, you're talking about creating a controller called page.php, and I'm talking about creating a VIEW called page.php.

My method only helps reduce the number of views you have to call in each controller if you're maintaining a lot of different view modules like i often do.

El Forum

[eluser]strogg[/eluser]
thanks @mahuti that's more clear.

I also found CI sample CMS codes in Forge. http://www.ciforge.com/trac/codeignition, just trunk preview avaible only and seems to be old, but it helps me about understanding concept.

And Rapyd Components have data presentation & editing classes, thats to way to create CRUD interfaces. Looks nice.

El Forum

[eluser]moustafa[/eluser]
thanks...

El Forum

[eluser]moustafa[/eluser]
thanks...