Actions

J2.5 talk

Difference between revisions of "Developing a MVC Component/Developing a Basic Component"

From Joomla! Documentation

(Removed my previous comment. Used a v1.6 tutorial with 1.5. My mistake, sorry.)
 
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
== Notice: Undefined property: JAdministrator::$JComponentTitle ==
  
 +
I received the following error message:
 +
 +
Notice: Undefined property: JAdministrator :: $ JComponentTitle in xxxxxxxxxxxx\ administrator\modules\mod_title\ mod_title.php on line 13
 +
 +
I'm running Joomla 2.5.7 in local development server with Apache 2.2.22, PHP 5.4.0, MySQL 5.5 on Windows Vista Home Premium (32 bit)
 +
 +
It possible that this error message appears me because my site is not in the Web, or you need to correct the code?
 +
 +
----
 +
 +
>> No, this is a behaviour present in Jommla since 2.5.7. The notice will vanish if you explicitely define the component title. Place this command inside the display() function, which is a part of the HelloWorldViewHelloWorlds class in view.html.php file (\admin\views\helloworlds folder in this example, and \administrator\components\com_helloworld\views\helloworlds\view.html.php after installation of the component):
 +
 +
<source lang="php">JToolBarHelper::title('title');</source>
 +
 +
However, the fact that the notice is displayed when the title is not explicitelly defined may be regarded as a minor mistake. To correct it you may place this temporary manual patch inside the /administrator/modules/mod_title/mod_title.php file:
 +
<source lang="php">
 +
if (isset(JFactory::getApplication()->JComponentTitle)){
 +
  $title = JFactory::getApplication()->JComponentTitle;
 +
}
 +
else{
 +
  $title = '';
 +
}
 +
</source>
 +
You can read more here: [http://forum.joomla.org/viewtopic.php?t=751007]
 +
 +
There is a bug tracker created for this issue so it will be probably corrected in the next version of Joomla 2.5 If so, feel free to delete my notice.
 +
 +
== Component name in manifestfile has to be conform ==
 +
 +
In Joomla 1.6 the component name specified in the manifest file has to follow the pattern 'com_componentname'. So here it should be
 +
 +
<name>com_helloworld</name>
 +
 +
It will matter at least in the menu manager, where I discovered this problem.
 +
 +
== Archive is created for version 1.6 instead of 2.5 ==
 +
 +
In the section "''Packaging an installation zip file''", archive file offered as an example (located here: http://joomlacode.org/gf/download/frsrelease/11394/58225/com_helloworld-1.6-part01.zip) contains an XML file which has a line:
 +
 +
'''<extension type="component" version="1.6.0" method="upgrade">'''
 +
 +
instead of
 +
 +
'''<extension type="component" version="2.5.0" method="upgrade">'''
 +
 +
which should be fixed, I guess.
 +
 +
== Broken links to zip downloads ==
 +
 +
Example zips reside here: http://www.leyar.com/joomlaorg/part01.zip
 +
This site is suspended, please prolong it's hosting or upload archives to another site

Latest revision as of 14:46, 3 May 2013

Contents

Notice: Undefined property: JAdministrator::$JComponentTitle

I received the following error message:

Notice: Undefined property: JAdministrator :: $ JComponentTitle in xxxxxxxxxxxx\ administrator\modules\mod_title\ mod_title.php on line 13

I'm running Joomla 2.5.7 in local development server with Apache 2.2.22, PHP 5.4.0, MySQL 5.5 on Windows Vista Home Premium (32 bit)

It possible that this error message appears me because my site is not in the Web, or you need to correct the code?


>> No, this is a behaviour present in Jommla since 2.5.7. The notice will vanish if you explicitely define the component title. Place this command inside the display() function, which is a part of the HelloWorldViewHelloWorlds class in view.html.php file (\admin\views\helloworlds folder in this example, and \administrator\components\com_helloworld\views\helloworlds\view.html.php after installation of the component):

JToolBarHelper::title('title');

However, the fact that the notice is displayed when the title is not explicitelly defined may be regarded as a minor mistake. To correct it you may place this temporary manual patch inside the /administrator/modules/mod_title/mod_title.php file:

 if (isset(JFactory::getApplication()->JComponentTitle)){
  $title = JFactory::getApplication()->JComponentTitle;
 }
 else{
  $title = '';
 }

You can read more here: [1]

There is a bug tracker created for this issue so it will be probably corrected in the next version of Joomla 2.5 If so, feel free to delete my notice.

Component name in manifestfile has to be conform

In Joomla 1.6 the component name specified in the manifest file has to follow the pattern 'com_componentname'. So here it should be

<name>com_helloworld</name>

It will matter at least in the menu manager, where I discovered this problem.

Archive is created for version 1.6 instead of 2.5

In the section "Packaging an installation zip file", archive file offered as an example (located here: http://joomlacode.org/gf/download/frsrelease/11394/58225/com_helloworld-1.6-part01.zip) contains an XML file which has a line:

<extension type="component" version="1.6.0" method="upgrade">

instead of

<extension type="component" version="2.5.0" method="upgrade">

which should be fixed, I guess.

Broken links to zip downloads

Example zips reside here: http://www.leyar.com/joomlaorg/part01.zip This site is suspended, please prolong it's hosting or upload archives to another site