MVC for Joomla tutorial and array_merge - Joomla! Forum - community, help and support


hi,

i'm running through tutorial developing model-view-controller component joomla 2.5 on 7th step.

in /admin/models/fields/helloworld.php file following code:

code: select all

protected function getoptions()
        {
                $db = jfactory::getdbo();
                $query = $db->getquery(true);
                $query->select('id,greeting');
                $query->from('#__helloworld');
                $db->setquery((string)$query);
                $messages = $db->loadobjectlist();
                $options = array();
                if ($messages)
                {
                        foreach($messages $message)
                        {
                                $options[] = jhtml::_('select.option', $message->id, $message->greeting);
                        }
                }
                $options = array_merge(parent::getoptions(), $options);
                return $options;
        }


can explain use of array_merge here? being merged with? contain whole select element rather options , being merged other select elements in of component.

also, there recommended way answer question such turning on debugging or rather trying put own dumps output see happening?

thanks.

what you're looking @ options of parent class being merged options of extended class. useful in event parent class has separate options child class. duplicate option items replaced new values child class.

if extension isn't going options parent class, don't see reason need merge them in. tutorial after all, giving example.





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

PProHeadless.exe has stopped working error when opening projects in Adobe Media Encoder CS6

Preconditions Failed. - Joomla! Forum - community, help and support