ciao a tutti,
vorrei modificare un file php. mi spiego meglio.
Vorrei modificare questa riga:
Codice PHP:
if (trim( document.adminForm.title.value ) == "") {
alert( '<?php echo JText::_('Item must have a title', true); ?>' );
} else if (trim( document.adminForm.catid.value ) == "0") {
alert( '<?php echo JText::_('Please select a category', true); ?>' );
}
else {
<?php if(!$this->params->get('taggingSystem')): ?>
var getSelectedTags = document.getElementById("selectedTags");
for(i=0; i<getSelectedTags.options.length; i++) getSelectedTags.options[i].selected = true;
<?php endif; ?>
submitform( pressbutton );
}
In modo che nel momento in cui l'articolo viene salvato, non solo il codice controlli che ci sia un Titolo e sia stata selezionata una Categoria, ma anche che sia stato inserito un tag:
Codice PHP:
<tr>
<td><label><?php echo JText::_('Tag'); ?></label></td>
<td>
<?php if($this->params->get('taggingSystem')): ?>
<ul class="tags">
<?php if(isset($this->row->tags) && count($this->row->tags)): ?>
<?php foreach($this->row->tags as $tag): ?>
<li class="addedTag">
<?php echo $tag->name; ?>
<span class="tagRemove" onclick="this.getParent().remove();">x</span>
<input type="hidden" name="tags[]" value="<?php echo $tag->name; ?>" />
<?php endforeach; ?>
<?php endif; ?>
<li class="tagAdd"><input type="text" id="search-field" />
<li class="clr">
[/list]
<span class="k2Note">
<?php echo JText::_('Write a tag and press "return" or "comma" to add it.'); ?>
</span>
<?php else: ?>
<?php if( !$this->params->get('lockTags') || $this->user->gid>23): ?>
<div style="float:left;">
<input type="text" name="tag" id="tag" />
<input type="button" id="newTagButton" value="<?php echo JText::_('Add'); ?>" />
</div>
<div id="tagsLog"></div>
<div class="clr"></div>
<span class="k2Note">
<?php echo JText::_('Write a tag and press "Add" to insert it to the available tags list.
New tags are appended at the bottom of the available tags list (left).'); ?>
</span>
<?php endif; ?>
<table cellspacing="0" cellpadding="0" border="0" id="tagLists">
<tr>
<td id="tagListsLeft">
<span><?php echo JText::_('Available tags'); ?></span>
<?php echo $this->lists['tags']; ?>
</td>
<td id="tagListsButtons">
<input type="button" id="addTagButton" value="<?php echo JText::_('Add'); ?> »" />
<input type="button" id="removeTagButton" value="« <?php echo JText::_('Remove'); ?>" />
</td>
<td id="tagListsRight">
<span><?php echo JText::_('Selected tags'); ?></span>
<?php echo $this->lists['selectedTags']; ?>
</td>
</tr>
</table>
<?php endif; ?>
</td>
<td><label><?php echo JText::_('Category'); ?></label></td>
<td><?php echo $this->lists['categories']; ?></td>
</tr>
grazie a tutti