Thanks! I haven’t even looked at the admin part yet so I have no idea how bad that will be to figure out, hopefully not awful but I am going to try and figure out as much as I can in the next few days so I can get something posted here.
Great work! One thing though: I see you have a setup script to create the table needed for the model. When will this script be run? I mean, how do you install the module?
The script is run if the news table does not exist in the database, it will check upon the first instance of the module being accessed. I didn’t put any sample data in there but I should probably modify it for that or else nothing will be outputted.
thats great! I’ve done some modules too and I’m really fed up with this painfull and time consuming process. I took your files and included them into a small Module Creator Script. This will make it even more easier to write custom modules for everyone.
Just dump the content of the zip file to any document root, call the folder and enter your Namespace and Module name. All required files will be generated. All what’s left to do is copy the files and folders to your Magento installation (and of course implement functionallity).
Hope this will help someone
Best regards,
daniel
Update 23/06/2008:
Added Adminhtml Support to ModuleCreator.
See this is what community is all about Thanks for the great work danieln! I am working on the adminhtml part of it now and making good progress, faster than I would have thought so hopefully I will have something in the next day or so to have up here.
@danieln: Thank you very much… that’s a very useful Tool.
I tried out and it did what it had to do . But I found a little bug:
The Model Classname was not generated correctly, still have <Namespace_Module> at the beginning.
Everything else looks pretty good.
Do you know how to create an Admin module ?
I am working on the admin module right now, I have it where it will create a menu item and display stuff in a phtml file. I am trying to get it to pull data through the grid view widget with an edit screen since that is the most common request usually. As soon as I have it working and some of these bugs ironed out I will update here.
@alistek: that would be very great, right now I am stuck with Adminhtml Blocks and furthermore how to sperate the files correctly.
Looking forward to seeing your solution.
Yeah, I am doing my best but I keep running into an error with trying to use the grid widgets on the page, telling me it can’t extend the class and no matter what combination I try something isn’t right. It will take me a bit longer than I had hoped, does anyone else have any experience extending that?
Alright guys I have hit a bit of a wall. It is fairly easy to get the backend working to display a menu item and a custom page, etc. But I am trying to use the grid class so that I can autocreate and load the data with edit forms like other Magento modules do. Here is the code so far:
Note: I am not generalizing it until I get this working correctly.
class LC_News_Adminhtml_ItemsController extends Mage_Adminhtml_Controller_action {
public function indexAction() { $this->loadLayout(); $this->_setActiveMenu('news/items'); $this->_addContent($this->getLayout()->createBlock('news/adminhtml_news')); $this->renderLayout(); } }
/app/design/adminhtml/default/default/template/news/items.phtml
Note: This doesn’t do anything really other then display text just to show it’s working.