I am not exactly sure where I should be adding the lines, of if it is needed. So I am copying the code from my admin.garyscookbook.php file from lines 460 - 520. If you can help a bit with how it should look, that would be great. I am not very good with PHP. I can find things sometimes, but when it comes to writing. I am clueless.
Code:
if (count($categories) < 1) $mainframe->redirect("index2.php?option=categories§ion=$option", 'You must add a category for this section first.');
//$clist = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1"', 'value', 'text', intval( $row->catid ) );
$clist = ShowDropDownCategoryList($row->catid , 'catid', ' size="1"');
$clist2 = ShowDropDownCategoryList($row->catid2 , 'catid2', ' size="1"');
$clist3 = ShowDropDownCategoryList($row->catid3 , 'catid3', ' size="1"');
$clist4 = ShowDropDownCategoryList($row->catid4 , 'catid4', ' size="1"');
$clist5 = ShowDropDownCategoryList($row->catid5 , 'catid5', ' size="1"');
// Create Picture List
$imgFiles = JFolder::files("$GKBabsolut/$ag_pathimages");
// $imgFiles = mosReadDirectory( "$GKBabsolut/$ag_pathimages" );
$images = array(JHTML::_('select.option', '', JText::_('Select Recipe Picture')));
$file="";
foreach ($imgFiles as $file) {
// eregi has to be replaced. Notice with php 5.3
// if (eregi("bmp|gif|jpg|png|jpeg", $file)) {
if(stristr($file, 'bmp') || stristr($file, 'gif') || stristr($file, 'jpg') || stristr($file, 'png') || stristr($file, 'jpeg'))
$images[] = JHTML::_('select.option', $file);
}
$imagelist = JHTML::_('select.genericlist', $images, 'imgfilename', "class=\"inputbox\" size=\"1\""
. " onchange=\"javascript:if (document.forms[0].imgfilename.options[selectedIndex].value!='') {document.imagelib2.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].imgfilename.options[selectedIndex].value} else {document.imagelib2.src='../images/M_images/blank.png'}\"",
'value', 'text', $row->imgfilename);
$imagelist1 = JHTML::_('select.genericlist', $images, 'expic1', "class=\"inputbox\" size=\"1\""
. " onchange=\"javascript:if (document.forms[0].expic1.options[selectedIndex].value!='') {document.expiclib1.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].expic1.options[selectedIndex].value} else {document.expiclib1.src='../images/M_images/blank.png'}\"",
'value', 'text', $row->expic1);
$imagelist2 = JHTML::_('select.genericlist', $images, 'expic2', "class=\"inputbox\" size=\"1\""
. " onchange=\"javascript:if (document.forms[0].expic2.options[selectedIndex].value!='') {document.expiclib2.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].expic2.options[selectedIndex].value} else {document.expiclib2.src='../images/M_images/blank.png'}\"",
'value', 'text', $row->expic2);
$imagelist3 = JHTML::_('select.genericlist', $images, 'expic3', "class=\"inputbox\" size=\"1\""
. " onchange=\"javascript:if (document.forms[0].expic3.options[selectedIndex].value!='') {document.expiclib3.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].expic3.options[selectedIndex].value} else {document.expiclib3.src='../images/M_images/blank.png'}\"",
'value', 'text', $row->expic3);
$imagelist4 = JHTML::_('select.genericlist', $images, 'expic4', "class=\"inputbox\" size=\"1\""
. " onchange=\"javascript:if (document.forms[0].expic4.options[selectedIndex].value!='') {document.expiclib4.src='$GKB_Live_site/$ag_pathimages/' + document.forms[0].expic4.options[selectedIndex].value} else {document.expiclib4.src='../images/M_images/blank.png'}\"",
'value', 'text', $row->expic4);
// Create Thumbail List
$thuFiles = JFolder::files("$GKBabsolut/$ag_paththumbs");
$thumbs = array(JHTML::_('select.option', '', JText::_('Select Recipe Thumbnail')));
$tfile="";
foreach ($thuFiles as $tfile) {
//notice error php 5.3
// if (eregi("bmp|gif|jpg|png|jpeg", $tfile)) {
if(stristr($tfile, 'bmp') || stristr($file, 'gif') || stristr($file, 'jpg') || stristr($file, 'png') || stristr($file, 'jpeg'))
$thumbs[] = JHTML::_('select.option', $tfile);
}
$thumblist = JHTML::_('select.genericlist', $thumbs, 'imgthumbname', "class=\"inputbox\" size=\"1\""
. " onchange=\"javascript:if (document.forms[0].imgthumbname.options[selectedIndex].value!='') {document.imagelib.src='$GKB_Live_site/$ag_paththumbs/' + document.forms[0].imgthumbname.options[selectedIndex].value} else {document.imagelib.src='../images/M_images/blank.png'}\"",
'value', 'text', $row->imgthumbname);
// get list of Authors for dropdown liste
$query = "SELECT * FROM `#__users` WHERE `block` =0 AND `lastvisitDate` <> '0000-00-00 00:00:00' ORDER BY `Username`";
$dbGKB->setQuery($query);
$authors[] = JHTML::_('select.option', '0', '- '.JText::_('Select Author').' -', 'id', 'username' );
$authors = array_merge($authors, $dbGKB->loadObjectList());
if ($row->created_by == 0) {
$dbGKB->setQuery('SELECT * FROM `#__users` WHERE `username` = "' . $row->imgauthor . '" and `block` = 0');
$rows2 = $dbGKB->loadObjectList();
if (count($rows2) >0) {
$row2 = $rows2[0];
$row->created_by = $row2->id;
}
}
Hopefully we can figure this thing out. It is not an extremely big deal not to show the thumbnails, but it would be nice.