Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Joomla 3.0.1 DEV
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ChristisKing  
View profile  
 More options Nov 8 2012, 1:29 pm
From: ChristisKing <austin.generalgr...@gmail.com>
Date: Thu, 8 Nov 2012 10:29:51 -0800 (PST)
Local: Thurs, Nov 8 2012 1:29 pm
Subject: Joomla 3.0.1 DEV

I am new to Joomla dev, but an MVC design old timer. I'm developing a huge
component in Joomla 3.0.1, but cant find a very good tutorial on what the
Joomla MVC really makes possible.
I have several questions. I come from DJANGO, in my opinion the bets MVC,
but I am trying out joomla due to my companies desire.

What SHOULD I do with models and NOT with views.

What Variable can I throw at a view from a controller without putting them
in the url. Do I have to use Globals?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Gies  
View profile  
 More options Nov 8 2012, 6:55 pm
From: Brad Gies <rbg...@gmail.com>
Date: Fri, 09 Nov 2012 07:55:11 +0800
Local: Thurs, Nov 8 2012 6:55 pm
Subject: Re: [jcms] Joomla 3.0.1 DEV
Hi ChristisKing,

I'll just answer your questions generically as you didn't ask for
specifics.

It sounds like you know MVC well, so just use MVC best practices with
Joomla. IE. Controllers pick the model, tell it to retrieve the data,
then controllers choose the view, and assign the model, and any other
data/variables it wants, to the view. Models should only retrieve and
store data, Views should not have to know which model got the data, and
the controller worries about all that. Your controller or sub controller
can assign any variable it wants to a view.

FYI, some of the Joomla core components and many third party extensions
have a bunch of logic in the views that using MVC best practices belong
in the controllers, but it doesn't have to be that way, so just use best
practices.

Brad.

On 2012-11-09 2:29 AM, ChristisKing wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
piotr_cz  
View profile  
 More options Nov 9 2012, 5:31 am
From: piotr_cz <pkoniec...@hotmail.com>
Date: Fri, 9 Nov 2012 02:31:06 -0800 (PST)
Local: Fri, Nov 9 2012 5:31 am
Subject: Re: Joomla 3.0.1 DEV
Hi there.
Starting point is the documentation page (docs.joomla.org), especially
series 'Developing a Model-View-Controlller Component in Joomla 2.5':
http://docs.joomla.org/Developing_a_Model-View-Controller_(MVC)_Compo....
(I read somewhere there will be an update for 3.0). It takes about one
afternoon to read trough, but it's the best thing to start with.

You might also take a look how some simpler component work
(com_weblinks) and start with the frontend part (/components/
com_contact).

Don't get distracted by fact that in Jooma 2.5+ MVC component classes
have *Legacy suffix. This means that there is new MVC package
available, but CMS doesn't use it yet (transition will take some time
and IMHO it's more convenient for non-CMS purposes like webapps).

Globals are considered an antipattern. Controllers create models and
views, assign variables to models and execute methods. Actually much
this is happening under the cover by base classes (like you don't need
own 'display' method, because base class determines which view and
model are related to current request and passes variables to these).

On Nov 8, 7:29 pm, ChristisKing <austin.generalgr...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
reynaldo celaya III  
View profile  
 More options Nov 10 2012, 2:10 am
From: reynaldo celaya III <rcela...@gmail.com>
Date: Fri, 9 Nov 2012 23:10:38 -0800 (PST)
Local: Sat, Nov 10 2012 2:10 am
Subject: Re: Joomla 3.0.1 DEV

> I have several questions. I come from DJANGO, in my opinion the best MVC,
> but I am trying out joomla due to my companies desire.

> I too love django ORM.... the differences with Joomla is the flow. Django

entry points are the view function that the urls are mapped to. Joomla
follows more of a MVC design pattern whereas django kinda blends the
Controller and View(Django seems more like Model,View,Template). Joomla's
controller is where you parse request variables(using an object JInput),
pass them to the models(JModelLegacy), instantiate a view(JViewLegacy),
pass model/models instances to the view($view->setModel( $model )), and
display the view($view->display()). The Views are similar to django only
being different because the view doesn't necessarily instantiate the
models, but uses the models and persists variables to be passed into the
templates using $this->varname and from your templates accessing using
$this->varname ($this context is the view object). Thats my shotgun blast
of an answer!

What SHOULD I do with models and NOT with views.


I usually just stay away from any db access in the Views if i find myself
wanting to do that I create a model. In Joomla models you will be dealing
with table classes, using JInput to create sql queries..etc.... you will be
writing alot more sql in your models. Sorry No ORM yet - any takers?

> What Variable can I throw at a view from a controller without putting them
> in the url. Do I have to use Globals?

The only variables that you should be throwing at the view are models,and
setting the layout, but you can set request variables inside the controller
and use JInput to access them inside your view.

Look at the router.php in the com_content component as a example of routing
so you dont go crazy expecting things to magically happen. Django urls.py
is much easier....

 Also heres a cool tip
Check out this request:
http://yoursite.com/index.php?option=com_yourcomponent&task=controlle...
this will load the controller in:
com_yourcomponent/controllers/controllername.php and call the public
function "taskname"

So Django's Great, & Joomla's Great. Hope any of this helps.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »