Developing a MVC Component/Adding configuration: Difference between revisions
From Joomla! Documentation
No edit summary |
→missing in admin\views\helloworld\tmpl\edit.php: new section |
||
| Line 41: | Line 41: | ||
After changing files from 0.12 to 0.13 and downloading part13.zip I can't reach FrontEnd of HelloWorld component. I receive erorr 500. :( [[User:CodeBY|CodeBY]] 04:48, 4 May 2012 (CDT) | After changing files from 0.12 to 0.13 and downloading part13.zip I can't reach FrontEnd of HelloWorld component. I receive erorr 500. :( [[User:CodeBY|CodeBY]] 04:48, 4 May 2012 (CDT) | ||
== missing </fieldset> in admin\views\helloworld\tmpl\edit.php == | |||
It does not look like a critical error. | |||
The first 28 lines of the file admin\views\helloworld\tmpl\edit.php should look like this, as shown in the tutorial. | |||
<?php | |||
// No direct access | |||
defined('_JEXEC') or die('Restricted access'); | |||
JHtml::_('behavior.tooltip'); | |||
JHtml::_('behavior.formvalidation'); | |||
$params = $this->form->getFieldsets('params'); | |||
?> | |||
<form action="<?php echo JRoute::_('index.php?option=com_helloworld&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="helloworld-form" class="form-validate"> | |||
<div class="width-60 fltlft"> | |||
<fieldset class="adminform"> | |||
<legend><?php echo JText::_( 'COM_HELLOWORLD_HELLOWORLD_DETAILS' ); ?></legend> | |||
<ul class="adminformlist"> | |||
<?php foreach($this->form->getFieldset('details') as $field): ?> | |||
<li><?php echo $field->label;echo $field->input;?></li> | |||
<?php endforeach; ?> | |||
</ul> | |||
'''</fieldset>''' | |||
</div> | |||
The file in the zipfile is missing this line </fieldset> (line 27) | |||
Another minor detail is that the page on the website shows blocks of <?php ... ?> whereas the file as the php open and close per line. | |||
Does not influence the working. But is good to know when comparing your code. I use winmerge to compare my files with those in the zip file. Hoping to find that typo that prevents my version from running as it should ;-( | |||
Revision as of 16:28, 17 October 2012
In the function
/**
* Overloaded load function
*
* @param int $pk primary key
* @param boolean $reset reset data
* @return boolean
* @see JTable:load
*/
public function load($pk = null, $reset = true)
{
if (parent::load($pk, $reset))
{
// Convert the params field to a registry.
$params = new JRegistry;
// loadJSON is @deprecated 12.1 Use loadString passing JSON as the format instead.
// $params->loadString($this->item->params, 'JSON');
//------------------------------------------------------------
$params->loadJSON($this->item->params);
//------------------------------------------------------------
$this->params = $params;
return true;
}
else
{
return false;
}
}
The line bracketed above is actually, $params->loadJSON($this->params); I am not sure which is 100% correct.
Just done a quick test and the one WITHOUT the 'item' is correct.
After changing files from 0.12 to 0.13 and downloading part13.zip I can't reach FrontEnd of HelloWorld component. I receive erorr 500. :( CodeBY 04:48, 4 May 2012 (CDT)
missing </fieldset> in admin\views\helloworld\tmpl\edit.php
It does not look like a critical error.
The first 28 lines of the file admin\views\helloworld\tmpl\edit.php should look like this, as shown in the tutorial. <?php // No direct access defined('_JEXEC') or die('Restricted access'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); $params = $this->form->getFieldsets('params'); ?> <form action="<?php echo JRoute::_('index.php?option=com_helloworld&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="helloworld-form" class="form-validate">
<fieldset class="adminform"> <legend><?php echo JText::_( 'COM_HELLOWORLD_HELLOWORLD_DETAILS' ); ?></legend>
-
<?php foreach($this->form->getFieldset('details') as $field): ?>
- <?php echo $field->label;echo $field->input;?> <?php endforeach; ?>
</fieldset>
The file in the zipfile is missing this line </fieldset> (line 27)
Another minor detail is that the page on the website shows blocks of <?php ... ?> whereas the file as the php open and close per line.
Does not influence the working. But is good to know when comparing your code. I use winmerge to compare my files with those in the zip file. Hoping to find that typo that prevents my version from running as it should ;-(