1
Ilija
Please, don`t mix HTML and PHP!!! (simple MyDownloads hack)
  • 2003/10/18 20:58

  • Ilija

  • Just popping in

  • Posts: 23

  • Since: 2003/9/9 1


I downloaded MyDownloads and installed it. Then I started to edit templates.

I don`t like subcats displayed as one line with , between it. I like them in list. But I needed to hack MyDownloads because developers generetated all links in PHP code.

If you use smarty then use it as it should be used!!! NEVER mix PHP and HTML code!!!

Hack:

index.php (line 40). replace while block:

$down_cats = array();
$counter 0;
while(
$myrow $xoopsDB->fetchArray($result)):
  {
    if (
$myrow['imgurl'] && $myrow['imgurl'] != "http://" && $myrow['imgurl'] != "blank.gif"):
      { 
$imgurl XOOPS_URL."/".$xoopsModuleConfig['catimage']."/".$myts->makeTboxData4Show($myrow['imgurl']); }
    else:
      { 
$imgurl ''; }
    endif;
  
    
$down_cats[$counter]['cat_id'] = $myrow['cid'];
    
$down_cats[$counter]['title'] = $myts->makeTboxData4Show($myrow['title']);
    
$down_cats[$counter]['image'] = $imgurl;
    
$down_cats[$counter]['total'] = getTotalItems($myrow['cid'], 1);

    
// get child category objects
    
$arr = array();
    
$arr $mytree->getFirstChild($myrow['cid'], "title");
    
$chcount 0;
    
$subcategories = array();

    foreach(
$arr as $ele)
      {
        
$chtitle=$myts->makeTboxData4Show($ele['title']);
        
$subcategories[$chcount]['cat_id'] = $ele['cid'];
        
$subcategories[$chcount]['cat_title'] = $chtitle;
        
$chcount++;
      }
    
$down_cats[$counter]['subs'] = $subcategories;
    
    
$counter++;
  }
endwhile;
$xoopsTpl->assign('down_cats'$down_cats);


mydownload_index.html template file. Replace foreach block with this code:

<{section name=cats loop=$down_cats}>
  <
tr class="<{cycle values="evenodd"}>">
    <
td width="40%" style="vertical-align: middle" align="center">
    <{if 
$down_cats[cats].image <> ''}>
      <
img src="<{$down_cats[cats].image}>" alt="<{$down_cats[cats].title}>" /><br />
    <{/if}>
      <
a href="<{$xoops_url}>/modules/mydownloads/viewcat.php?cid=<{$down_cats[cats].cat_id}>"><{$down_cats[cats].title}>a> (<{$down_cats[cats].total}>)
    td>
    <
td width="60%">
      <
br /><ul>
      <{
section name=subs loop=$down_cats[cats].subs}>
        <
li>
          <
a href="<{$xoops_url}>/modules/mydownloads/viewcat.php?cid=<{$down_cats[cats].subs[subs].cat_id}>"><{$down_cats[cats].subs[subs].cat_title}>a>
        li>
      <{/
section}>
      ul>
    td>
  tr>
<{/
section}>


Also, there is error (as I see it it is error d:) ) with download links (mix images and download title but I want them separated). I`ll hack it soon...

Over and out!

Login

Who's Online

273 user(s) are online (213 user(s) are browsing Support Forums)


Members: 0


Guests: 273


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits