Hi,
I have done most of it now using a component part (I would like to have this in the plugin folder but not sure on how to call it then, currently called with index.php?option=com_dybanners&task=select&tmpl=component&e_name='.$name).
The last part left in completing it before i look at then using directly in a plugin is getting information from textboxes back, the drop downs are all working OK but how can i solve the textbox part:
Extract from my controllerCode:
function selectbannerfield( $name = 'default' )
{
$db = &JFactory::getDBO();
$query = "SELECT name AS text, bid AS value FROM #__banner ORDER BY bid, name";
$db->setQuery($query);
$options[] = JHTML::_('select.option','title','+ '.JText::_('TITLE').' +');
$options[] = JHTML::_('select.option','random','+ '.JText::_('RANDOM').' +');
$options = array_merge( $options, $db->loadObjectList() );
array_unshift($options, JHTML::_('select.option', 'banner_id/title/random', '- '.JText::_('Select Banner Field').' -', 'value', 'text'));
return JHTML::_('select.genericlist', $options, $name, 'class="inputbox"', 'value', 'text', $value, $name );
}
function selectbannerwindow( $name = 'default' )
{
$options = array();
$options[] = JHTML::_('select.option','0',''.JText::_('Parent Window').'');
$options[] = JHTML::_('select.option','1',''.JText::_('New Window With Browser Navigation').'');
$options[] = JHTML::_('select.option','2',''.JText::_('Popup Window Without Browser Navigation').'');
array_unshift($options, JHTML::_('select.option', 'window_type', '- '.JText::_('Select Banner Window').' -', 'value', 'text'));
return JHTML::_('select.genericlist', $options, $name, 'class="inputbox"', 'value', 'text', $value, $name );
}
function selectbannersuffix( $name = 'default' )
{
return JHTML::_('select.genericlist', $options, $name, 'class="inputbox"', 'value', 'text', $value, $name );
}
Extract from my view:Code:
$eName = JRequest::getVar('e_name');
$eName = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
$list1 = & $this->selectbannerfield( 'bannerfield');
$list2 = & $this->selectbannerwindow( 'bannerwindow');
$list5 = & $this->selectbannerclient( 'bannerclient');
$list6 = & $this->selectbannercategory( 'bannercategory'); ?>
<script type="text/javascript">
function insertdybanners()
{
// Get the pagebreak title
var bannerfield = document.getElementById("bannerfield").value;
var bannerwindow = document.getElementById("bannerwindow").value;
// var bannersuffix = document.getElementById("bannersuffix").value;
// var bannerimagealt = document.getElementById("bannerimagealt").value;
var bannerclient = document.getElementById("bannerclient").value;
var bannercategory = document.getElementById("bannercategory").value;
var tag1 = '{dybanners}';
var tag2 = bannerfield;
var tag3 = ',';
var tag4 = bannerwindow;
// var tag5 = ',';
// var tag6 = bannersuffix;
// var tag7 = ',';
// var tag8 = bannerimagealt;
var tag9 = ',';
var tag10 = bannerclient;
var tag11 = ',';
var tag12 = bannercategory;
var tag13 = '{/dybanners}';
window.parent.jInsertEditorText(tag13, '<?php echo $eName; ?>');
window.parent.jInsertEditorText(tag12, '<?php echo $eName; ?>');
window.parent.jInsertEditorText(tag11, '<?php echo $eName; ?>');
window.parent.jInsertEditorText(tag10, '<?php echo $eName; ?>');
window.parent.jInsertEditorText(tag9, '<?php echo $eName; ?>');
// window.parent.jInsertEditorText(tag8, '<?php echo $eName; ?>');
// window.parent.jInsertEditorText(tag7, '<?php echo $eName; ?>');
// window.parent.jInsertEditorText(tag6, '<?php echo $eName; ?>');
// window.parent.jInsertEditorText(tag5, '<?php echo $eName; ?>');
window.parent.jInsertEditorText(tag4, '<?php echo $eName; ?>');
window.parent.jInsertEditorText(tag3, '<?php echo $eName; ?>');
window.parent.jInsertEditorText(tag2, '<?php echo $eName; ?>');
window.parent.jInsertEditorText(tag1, '<?php echo $eName; ?>');
window.parent.document.getElementById('sbox-window').close();
return false;
The textboxes are for suffix and alt (Only suffix is added in the controller above until i get that working).
Thanks
Dan