The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Jul 26, 2011 6:19 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri May 20, 2011 6:49 am
Posts: 48
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?


Top
 Profile  
 
PostPosted: Wed Jul 27, 2011 4:54 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri May 20, 2011 6:49 am
Posts: 48
nobody???, not even a referall? :'(


Top
 Profile  
 
PostPosted: Fri Sep 23, 2011 11:05 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Aug 18, 2011 5:59 pm
Posts: 4
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


Top
 Profile  
 
PostPosted: Wed Jan 04, 2012 2:09 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 24, 2005 1:05 pm
Posts: 113
Location: Vilnius, Lithuania
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?


Top
 Profile  
 
PostPosted: Tue Jan 24, 2012 8:12 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jan 11, 2007 6:00 am
Posts: 205
Location: New Hampshire - United States
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 



Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group