Actions

J2.5 talk

Difference between revisions of "Developing a MVC Component/Adding categories"

From Joomla! Documentation

m (Additional explanation about the controller helloworld.php file changes would be helpful.)
(4 intermediate revisions by 4 users not shown)
Line 11: Line 11:
  
 
Just an observation.
 
Just an observation.
 +
 +
 +
---
 +
 +
People who are using Joomla >= 2.5.5. will probably encounter a problem with categories menu - buttons for basic user actions missing (such as "New", "Edit" etc.) The solution can be found here: http://forum.joomla.org/viewtopic.php?f=642&t=730171
 +
 +
== Additional explanation about the controller helloworld.php file changes would be helpful. ==
 +
 +
The controller helloworld.php file changes from
 +
 +
<blockquote>// set default view if not set<br/>
 +
            JRequest::setVar('view', JRequest::getCmd('view', 'HelloWorlds'));</blockquote>
 +
 +
To
 +
 +
<blockquote>// set default view if not set<br/>
 +
            $input = JFactory::getApplication()->input;<br/>
 +
            $input->set('view', $input->getCmd('view', 'HelloWorlds'));</blockquote>
 +
 +
without any explanation as to the changes.
 +
 +
 +
*** JRequest is depricated and JInput is to be used

Revision as of 11:39, 8 February 2013

Why $query = new JDatabaseQuery; but not $query = &new JDatabaseQuery; ?

In ../models/fields/helloworld.php on line 29

If you use the line, $query = new JDatabaseQuery;, component works, but when helloworlds is added as menu item it causes the following error when item is clicked:

Fatal error: Cannot instantiate abstract class JDatabaseQuery in C:\xampp\htdocs\test_site\administrator\components\com_helloworld\models\fields\helloworld.php on line 29

Reverting back to code from part 11, $query = $db->getQuery(true);, does not throw error.

Just an observation.


---

People who are using Joomla >= 2.5.5. will probably encounter a problem with categories menu - buttons for basic user actions missing (such as "New", "Edit" etc.) The solution can be found here: http://forum.joomla.org/viewtopic.php?f=642&t=730171

Additional explanation about the controller helloworld.php file changes would be helpful.

The controller helloworld.php file changes from

// set default view if not set
JRequest::setVar('view', JRequest::getCmd('view', 'HelloWorlds'));

To

// set default view if not set
$input = JFactory::getApplication()->input;
$input->set('view', $input->getCmd('view', 'HelloWorlds'));

without any explanation as to the changes.


      • JRequest is depricated and JInput is to be used