Joomla Model state variables

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
hoomlajoomla
Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Fri May 20, 2011 6:49 am

Joomla Model state variables

Post by hoomlajoomla » Tue Jul 26, 2011 6:19 am

I have encountered the function get('state'), which , from documentation says something about 'model state variables'. Could someone please explain to me what 'model state variables' are?

hoomlajoomla
Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Fri May 20, 2011 6:49 am

Re: Joomla Model state variables

Post by hoomlajoomla » Wed Jul 27, 2011 4:54 am

nobody???, not even a referall? :'(

FredFlinStein
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Aug 18, 2011 5:59 pm

Re: Joomla Model state variables

Post by FredFlinStein » Fri Sep 23, 2011 11:05 pm

Was looking for the same question and found an answer.

The state object is your storage for variables. If you dont store any there are none by default. If you look at com_banners/controller.php you see how it could be used.

Here is another reference:
http://www.i-programmer.info/programmin ... ml?start=2

User avatar
VipArt
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 114
Joined: Thu Nov 24, 2005 1:05 pm
Location: Vilnius, Lithuania
Contact:

Re: Joomla Model state variables

Post by VipArt » Wed Jan 04, 2012 2:09 pm

doesn't this variable store information about published/unpublished items?

i.e. table `jos_banners` and `banner_clients` have column called "state", which, I think, is the newer version (in joomla 1.7) of joomla's 1.5 column `published`

no?

madchris
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 207
Joined: Thu Jan 11, 2007 6:00 am
Location: New Hampshire - United States
Contact:

Re: Joomla Model state variables

Post by madchris » Tue Jan 24, 2012 8:12 am

State variables are associated with functions like these, which are used in the model:

getState()
setState()
populateState()
getUserStateFromRequest()

They are often used to store information across multiple page views during the same session, like filter settings for viewing only certain records in a list (for example, to only view articles by a certain author in the Article Manager). When you come back to the list after leaving it, the filter settings are remembered.

If you're in a view, setting something equal to $this->get('State') will call the function getState() in the model. Setting something equal to $this->get('Marbles') in the view will call the function getMarbles() in the model.

The purpose of the 'state' column found in some database tables in Joomla 1.7 is a different concept. This is like the 'published' column in Joomla 1.5, with possible values like the following:

1 means published
0 means unpublished
2 means archived
-2 means trashed
http://www.madblanks.com - Quiz, survey, assessment, custom calculator, general purpose form extension


Locked

Return to “Templates for Joomla! 1.5”