Welcome, Guest
Username: Password: Remember me

TOPIC: Where should I start ? [joomla dev level 1]

Where should I start ? [joomla dev level 1] 14 Aug 2012 15:06 #3147

  • e-struct
  • e-struct's Avatar
  • Offline
  • Senior Member
  • Posts: 76
  • Thank you received: 4
  • Karma: 5
Hi,
I am an not a MVC Joomla coding guru, so I need some little help to start coding...
I guess that COOK does not follow strict Joomla structure (no such file controller.php ?)
Instead it uses some classes defined in admin/classes ...

So:
1:
Where to start to add some simple messages around the forms being generated by Cook ?
Which files must I edit / add first in case of using JDOM for example. I did not find any dom directory in site part ?
Otherwise I can add some code around the views/.../tmplt/<layout>.php but I have also a <layout>_form.php
but I am not really sure... if it's the right place.


Thank you for your kind support.
Last Edit: 14 Aug 2012 15:17 by e-struct.
The administrator has disabled public write access.

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 17:48 #3151

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Answer in two parts, just to get the comments easier to read after some replies.

Model View Controller is Design Pattern... Means it's a way to code, a way to organize the code.
Controller is about user interactions : what should happen if the user clicks save, or cancel,...
Model is about the database : getting the data, creating, deleting, modifying,...
View is about displaying the pages containing all infos.

A class is a bit of code that is often reused.
A class contains functions.
Class can extend another class, which is also cool.

So it's good to have classes because it helps not writing the same functions all over again.
Last Edit: 14 Aug 2012 17:54 by VeCrea.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 17:54 #3152

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
The strict Joomla structure will come with V2.0.
It is a long way to change all this new features, but it is coming soon. Don't worry.

By the way, if you are not in hurry, I highly recommend you to wait 2.0 before to start coding inside your component. (If you don't want to do the job twice)


<layout>_form.php is the file where you can customize your form page and add some messages around.
JDom is called in these files.

If you want to customize JDom, you find it in the dom directory of your backend component.


The classes in admin/classes are almost only overrides/surcharges of the native Joomla Classes.

Cook try to open more the functionalities to make it easier for your component, still respecting the Joomla concepts.
I would do my best in the future to propose theses added functionalities in the core of Joomla but I am too busy to contribute now. So I use the classes directory to store all the lacking functionalities what should be integrated in Joomla.

Creating Cook Self Service, I had to read almost all the Joomla code, and I found a lot to say about it. For sure Joomla is still improving, and I would probably add my color in it in the future.

Cook is not perfect, it is not finished (core), but I need your support during this period of time.

Regards.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 17:56 #3153

  • e-struct
  • e-struct's Avatar
  • Offline
  • Senior Member
  • Posts: 76
  • Thank you received: 4
  • Karma: 5
Thank you... that clarifies things.
Last Edit: 14 Aug 2012 18:00 by e-struct.
The administrator has disabled public write access.

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 17:59 #3154

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
I want to add a precision about the difference between Classes and Helpers.

Sometimes it can be percieved very similar.
My definition is not very precise and not definitive, but I would say :

Classes :
- Are part of MCV.
- Heavy objects
- Containing lot of properties
- Instancied (not static calls)

Helpers
- Light objects
- Can be called everywhere to help accomplishing a calculation, or a parsing, or send a mail for instance...
- Are often called in static
- Can be based on another framework, or independant.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: VeCrea

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 18:02 #3155

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Views are the easiest way to modify what cook gives you out of the box.
The best way to modify the views is to use template overrides. (if you don't know about them, you should take a look at how joomla templates are built. Just a hint : you have to have a HTML folder your in your template folder, and this HTML folder should contain a "com_yourcomponentname" folder to get template overrides to work.

About <layout>_form.php and <layout>_fly.php : it's cool to have two files because that's what you prepare in cook. You create bricks (fly and form) and you put different kind of infos in it. Fly is about displaying infos, Form is about getting user input. The third one is <layout>.php, which calls for the two others (simple thing : place the code calling for the form before or after the code calling for the fly, then observe the bricks position changing. It's also powerful when you modify the models because you then can call new variables from there, but it's not dev Level 1 so don't bother right now.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 18:03 #3156

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
About the differences between classes and helpers :
Well this one was useful to me. Thanks for that
Last Edit: 14 Aug 2012 18:04 by VeCrea.
The administrator has disabled public write access.

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 18:06 #3158

  • e-struct
  • e-struct's Avatar
  • Offline
  • Senior Member
  • Posts: 76
  • Thank you received: 4
  • Karma: 5
Thanks a lot to both of you.
The administrator has disabled public write access.

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 18:16 #3160

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
About <layout>_form.php and <layout>_fly.php : it's cool to have two files because that's what you prepare in cook. You create bricks (fly and form) and you put different kind of infos in it. Fly is about displaying infos, Form is about getting user input. The third one is <layout>.php, which calls for the two others (simple thing : place the code calling for the form before or after the code calling for the fly, then observe the bricks position changing. It's also powerful when you modify the models because you then can call new variables from there

Exactly.

Part of the roadmap of 2.0 (exclusive) :

In V2.0, I would also send the model to the layouts, so it will be really amazing.

The top of the layout file will be :
$items = $model_xxxxx->getItems();

So the model wil be prepared in the view file and sent to the layout.

  • That means, the same var $items or $item will be always the same for all bricks.
  • That means it will be possible to stack a lot o calls from differents models (excellent)
  • That means, it will be possible to play with the model directly in the template override, wich can be discutable (of course), but really powerfull to open the code at maximum level of possibilities.
Coding is now a piece of cake
Last Edit: 14 Aug 2012 18:17 by admin.
The administrator has disabled public write access.

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 18:22 #3162

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
admin wrote:
The top of the layout file will be :
$items = $model_xxxxx->getItems();

So the model wil be prepared in the view file and sent to the layout.

  • That means, the same var $items or $item will be always the same for all bricks.
  • That means it will be possible to stack a lot o calls from differents models (excellent)
  • That means, it will be possible to play with the model directly in the template override, wich can be discutable (of course), but really powerfull to open the code at maximum level of possibilities.
Will prevent us to have to re-edit the code everytime we download the component ?
And yes, it is discutable, because views and models should be separated (Model View Controller Design Pattern is all about getting it all well organized)...
The administrator has disabled public write access.

Re: Where should I start ? [joomla dev level 1] 14 Aug 2012 18:26 #3164

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
I mean, it is discutable, and not done yet. But sometimes it is boring to be limited.

Of course a malicious template could exploit it, and it is not a good idea.
But I am still searching the best way to code both secure and open.

By the way, coding in the template is what has been recommended to me by Seblod when I asked them how to customize an application created with Seblod !!!!

Well. No comment.
Coding is now a piece of cake
Last Edit: 14 Aug 2012 18:28 by admin.
The administrator has disabled public write access.
Time to create page: 0.118 seconds

Get Started