0
我正在使用Zoo CCK,并且弄乱了足够长的代码以使它看起来像我希望的样子。但是,当我提交该项目时,我收到一个我无法弄清楚的错误(标题中)。在PHP中保存项目(无效名称)时出错
为了减少混淆,我应该提及我对该文件所作的编辑是为$ message添加零件以及识别它的任何相关代码。
任何帮助,将不胜感激。这里是下面的文件代码:
错误:错误保存项目(无效的名称)
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
// register ElementOption class
App::getInstance('zoo')->loader->register('ElementOption', 'elements:option/option.php');
// register ElementRepeatable class
App::getInstance('zoo')->loader->register('ElementRepeatable', 'elements:repeatable/repeatable.php');
/*
Class: ElementSelect
The select element class
*/
class ElementMessage extends ElementOption implements iSubmittable {
/*
Function: edit
Renders the edit form field.
Returns:
String - html
*/
public function edit(){
$this->app->document->addStylesheet('elements:message/assets/css/submission.css');
// init vars
$options_from_config = $this->config->get('option', array());
$multiple = $this->config->get('multiple');
$default = $this->config->get('default');
$name = $this->config->get('name');
$message = $this->get('message');
if (count($options_from_config)) {
// set default, if item is new
if ($default != '' && $this->_item != null && $this->_item->id == 0) {
$this->set('option', $default);
}
$options = array();
if (!$multiple) {
$options[] = $this->app->html->_('select.option', '', '-' . JText::sprintf('Select %s', $name) . '-');
}
foreach ($options_from_config as $option) {
$options[] = $this->app->html->_('select.option', $option['value'], $option['name']);
}
$style = $multiple ? 'multiple="multiple" size="5"' : '';
$html[] = $this->app->html->_('select.genericlist', $options, $this->getControlName('option', true), $style, 'value', 'text', $this->get('option', array()));
$html[] = $this->app->html->_('control.text', $this->getControlName('Message'), $this->get('message'), 'name="message" size="30" maxlength="255" placeholder="'.JText::_('Message').'"');
// workaround: if nothing is selected, the element is still being transfered
$html[] = '<input type="hidden" name="'.$this->getControlName('select').'" value="1" />';
return implode("\n", $html);
}
return JText::_("There are no options to choose from.");
}
public function hasValue($params = array()) {
$message = $this->get('message');
return !empty($message);
}
}
嗨。我更改了两个实例并对它们进行了测试,但仍然有相同的错误。然后我只改变了其中的一个,它仍然给出了同样的错误。 – Steven 2012-07-31 00:17:44