Jump to content

Help With Making Modules


freshJet

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...