jDownloadsownloads.com

Advertisement
Advertisement:

Author Topic: Categories module  (Read 8784 times)

0 Members and 1 Guest are viewing this topic.

Offline waynenort

  • Newbie
  • *
  • Posts: 15
Categories module
« on: 18.06.2012 14:25:25 »
Hi Arno,

I've recently upgraded to Jdowmloads for Joomla 2.5. and had a go at altering the code for the 'Categories for Jdownloads' module. I know you didn't create this but it seems that joomlatune.com aren't supporting this anymore. Anyway I got it to work with Joomla 2.5, but still get a couple of small errors displaying. I was hoping you could help...
These are the errors that are displaying from the mod_jdownloads_cats.php file:
Notice: Trying to get property of non-object in /home/saintsbc/public_html/modules/mod_jdownloads_cats/mod_jdownloads_cats.php on line 80
Notice: Undefined variable: Itemid in /home/saintsbc/public_html/modules/mod_jdownloads_cats/mod_jdownloads_cats.php on line 112

Here is the mod_jdownloads_cats.php code and attached categories module component:

Thanks Wayne
 
Code: [Select]
<?php
/**
 * jDownloads Categories - shows categories list from the component jDownloads
 *
 **/
 
// ensure this file is being included by a parent file
(defined('_VALID_MOS') OR defined('_JEXEC')) or die('Direct Access to this location is not allowed.');

if (!
function_exists('jdownloads_cats_build_html')) { 
function jdownloads_cats_build_html$id$html$children$native$Itemid$active$level 0$maxlevel 9999) {

if (isset($children[$id]) && $level <= $maxlevel) {

foreach ($children[$id] as $v) {

if ($native) {
$link JRoute::_('index.php?option=com_jdownloads&amp;task=viewcategory&catid=' $v->id);
} else {
$link sefRelToAbs('index.php?option=com_jdownloads&amp;Itemid=' $Itemid '&amp;task=viewcategory&catid=' $v->id);
}

$html .= '<li>';

if ($v->id == $active) {
$html .= '<span class="active">' $v->title '</span>';
} else {
$html .= '<a href="' $link '" title="' $v->title '">' $v->title '</a>';
}

$nested_html jdownloads_cats_build_html($v->id''$children$native$Itemid$active$level 1);

if ($nested_html != '') {
$html .= '<ul>' $nested_html '</ul>';
}

$html .= '</li>';
}
}
return $html;
}
}

global 
$my;

if (
defined('_JEXEC')) {
$native 1;

$dbo = & JFactory::getDBO();
$option JRequest::getCmd('option');
$catid JRequest::getVar'catid', -1'''int' );
} else {
global $database;

$native 0;
$dbo $database;
$dbo->setQuery("SELECT id from #__menu WHERE link = 'index.php?option=com_jdownloads' and published = 1");
$Itemid $dbo->loadResult();

$option mosGetParam($_REQUEST'option''');
$catid mosGetParam($_REQUEST'catid', -1);

if (!$Itemid) {
$Itemid 999999;
}
}

if (
$option != 'com_jdownloads') {
$catid = -1;
}


$access '';

switch(
$my->gid) {
case 0:
$access '01';
break;
case 1:
$access '11';
break;
case 2:
$access '22';
break;
default:
$access '';
}

$where = array();
$where[] = 'published = 1';
$where[] = 'cat_access <= ' $access;

$dbo->setQuery('SELECT cat_id as id, cat_title as title, parent_id as parent FROM #__jdownloads_cats WHERE 'implode(' AND '$where ) . ' ORDER BY parent_id, ordering');
$cats $dbo->loadObjectList();

$html '<ul class="categories' $params->get('moduleclass_sfx') . '">';
    
if (
count($cats)) {
$children = array();
foreach ($cats as $v) {
$pt $v->parent;
$list = isset($children[$pt]) ? $children[$pt] : array();
array_push($list$v);
$children[$pt] = $list;
}

$html .= jdownloads_cats_build_html(0''$children$native$Itemid$catid);
}

$html .= '</ul>';

echo 
$html
?>
« Last Edit: 18.06.2012 14:26:58 by waynenort »

Offline Arno

  • Administrator
  • ***
  • Posts: 12.009
    • jDownloads.com
Re: Categories module
« Reply #1 on: 18.06.2012 15:17:29 »
Hello Wayne,
i think not that your changings works correct with Joomla 2.5 but i have not the time to check this complete. I hope you know, that in Joomla 2.5 are many changed.
When you need a categories module, so use the jDownloads tree module for J 2.5.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!

Offline waynenort

  • Newbie
  • *
  • Posts: 15
Re: Categories module
« Reply #2 on: 18.06.2012 23:23:21 »
Hi Arno, I installed mod_jdownloads_tree_2.0.zip.

It works, but also displays some minor errors.
Notice: Undefined variable: cat_itemid in /home/saintsbc/public_html/modules/mod_jdownloads_tree/mod_jdownloads_tree.php on line 134
Notice: Undefined variable: moduleclass_sfx in /home/saintsbc/public_html/modules/mod_jdownloads_tree/jDtree/jdownloadstree.php on line 248
Here's a screen capture of the error.

What could be the issue?

Thanks Wayne

Offline Arno

  • Administrator
  • ***
  • Posts: 12.009
    • jDownloads.com
Re: Categories module
« Reply #3 on: 18.06.2012 23:42:01 »
It seems that you use php 5.4?
I must update the module for this php version... i will do it tomorrow.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!

Offline waynenort

  • Newbie
  • *
  • Posts: 15
Re: Categories module
« Reply #4 on: 22.06.2012 10:20:47 »
Thanks for your help Arno. I can't see to find the updated version.

Thanks Wayne

Offline Arno

  • Administrator
  • ***
  • Posts: 12.009
    • jDownloads.com
Re: Categories module
« Reply #5 on: 23.06.2012 00:06:44 »
Sorry, but i have not the time for it yet.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!

Offline donalddee33

  • Newbie
  • *
  • Posts: 1
Re: Categories module
« Reply #6 on: 01.08.2012 16:54:28 »
I enjoy reading the comments above especially from Wayne, thanks for this informative topic you've shared.

Offline bulwary12

  • Newbie
  • *
  • Posts: 1
Re: Categories module
« Reply #7 on: 03.08.2012 09:22:04 »
Hi There,

Thanks for posting this code,this isvery helpful to the community

Have a wonderful day

Offline markdooms

  • Newbie
  • *
  • Posts: 1
Re: Categories module
« Reply #8 on: 08.08.2012 19:57:53 »
I am not really familiar with the code above stated, but other codes i have encountered were very sensitive, i should be accurate or else it would cause damage to the over all program.

Offline pegasusdba

  • Newbie
  • *
  • Posts: 1
    • Two Wheels Rule
Re: Categories module
« Reply #9 on: 23.01.2013 23:29:07 »
I look forward to the update. Thanks
ATVs & Scooters with free shipping
Cheap Motor Scooters

Offline Arno

  • Administrator
  • ***
  • Posts: 12.009
    • jDownloads.com
Re: Categories module
« Reply #10 on: 24.01.2013 13:18:32 »
I look forward to the update. Thanks
What exactly is the problem?
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!

 

Advertisement