freshJet Posted February 11, 2012 Report Share Posted February 11, 2012 I really want to make custom modules for myself (and maybe others eventually) but I can never do it. How do you pull the data? I can't write the PHP classes. I have read the documentation several times but I'm still stuck. Quote Link to comment Share on other sites More sharing options...
beerguts Posted February 14, 2012 Report Share Posted February 14, 2012 Hi, The key is to learn how the MVC (Model, View, Controller) structure works. phpVMS is based on this structure. Check out this post from Simpilot which is a very good explanation of how the structure works using a simple example in phpVMS: http://forum.phpvms.net/topic/4095-solved-with-many-thanks-coding-noob-need-help/page__p__27456#entry27456 In basic terms the Model is where you extract the data from the database. The view is how you want the data displayed on your site. The controller is the glue that connects both the model and the view and is used to control the data - when a user requests something on your site it handles the request by coordinating the model and view. That's a very basic explanation. I would recommend searching google for explanations on MVC. Once you understand the basics you can build your knowledge from there and subsequently develop your modules. Some of the other experienced coders may be able to clarify further. 1 Quote Link to comment Share on other sites More sharing options...
freshJet Posted February 14, 2012 Author Report Share Posted February 14, 2012 Thanks for the reply Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted February 14, 2012 Administrators Report Share Posted February 14, 2012 I made a blog post on how to build a basic full pilot roster module that shows all the pieces you should need. It may help you out. phpVMS Module Tutorial 1 Quote Link to comment Share on other sites More sharing options...
freshJet Posted February 15, 2012 Author Report Share Posted February 15, 2012 I made a blog post on how to build a basic full pilot roster module that shows all the pieces you should need. It may help you out. phpVMS Module Tutorial Brilliant, thanks Quote Link to comment Share on other sites More sharing options...
freshJet Posted February 17, 2012 Author Report Share Posted February 17, 2012 OK, let's be basic. Say I want a module that shows me a list of my fleet and a list of my hubs. If it were to be named 'test', I'd do: core/modules/test and add 'test.php' in there, am I right? OK, so, now I add this: class test extends CodonModule { public function index() { echo "test.tpl"; } } I take it this links to core/templates/test.tpl and ultimately skins/myskin/test.tpl? Now what about the data? Do I use the data from the classes in core/common? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.