EllisLab text mark
Advanced Search
     
Automatically create a channel using a module?
Posted: 27 June 2010 11:28 PM
Joined: 2009-06-05
103 posts

how do I automatically create a channel (or Controller in CodeIgniter terms) using a module?

—-

I am creating a module that I am going to use on a number of different projects. It’s basically going to show item details.

I am hoping to have accessible via a channel, once the module is installed, a form that I create to Add, Edit and delete these items.

Is it possible to have the channel (with a View loaded in) automatically set up via module (so I don’t have to recreate the channels on every install of the module)? How do I do it?

thanks for the help!

-Jayson

 Signature 

Jayson Ng

http://rxwebservices.com
http://mactumblr.com

 
Posted: 28 June 2010 03:32 AM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-11
575 posts

Hi,

in your upd.modulename.php install() function you’ll have to insert the necessary info into exp_channels, and then maybe also exp_field_groups and exp_channel_fields. I’d do a mysqldump of the db, then create a channel/fields with all the info you want, then do another db dump and then compare the two to know what you need to add in your install() function.

Check out devkit to generate the module skeleton: http://www.bybjorn.com/344/

grin

 Signature 

bybjorn.com: ExpressionEngine Freelancer - Premium ExpressionEngine 2.0 Themes - WDA: ExpressionEngine Add-ons - contact me on twitter: twitter.com/bjornbjorn - Zerply profile: zerp.ly/bjornbjorn

 
Posted: 28 June 2010 04:19 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2009-06-05
103 posts

awesome idea Bjorn! thanks!

I am using the devkit module too. smile

 Signature 

Jayson Ng

http://rxwebservices.com
http://mactumblr.com

 
Posted: 28 June 2010 04:21 AM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-11
575 posts

Cool, good luck with the module! grin

 Signature 

bybjorn.com: ExpressionEngine Freelancer - Premium ExpressionEngine 2.0 Themes - WDA: ExpressionEngine Add-ons - contact me on twitter: twitter.com/bjornbjorn - Zerply profile: zerp.ly/bjornbjorn