Go Back   PHP Link Directory Forum > PHP Link Directory (phpLD) > Mods and contribution Discussion > Mod Requests

Mod Requests Have a suggestion for a mod? Post it here. You may not always receive an answer, but phpLD devs and mod developers do regularly visit this forum. If you MUST get something done, you may need to opt for paid help.

Closed Thread
 
Thread Tools Display Modes
Old 03-29-2006   #1
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default categories in footer

hi,

i would like to have the main categories in footer. but not on main page.

anyone an idea ? (vers. 2.0)

thanks.
__________________
many thanks.

thompson.
thompson is offline  
Old 03-30-2006   #2
bobby9101
 
bobby9101's Avatar
 
Join Date: Sep 2005
Posts: 678
Default

i think i can do this for you, do you want me to test itand then post the code, or do you want me to do it on your site for you? either way it is just as easy
__________________
Please check your sig links
bobby9101 is offline  
Old 03-30-2006   #3
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

i wanna do it by myself. if you like, please post the code.
__________________
many thanks.

thompson.
thompson is offline  
Old 04-03-2006   #4
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

*push*
__________________
many thanks.

thompson.
thompson is offline  
Old 04-13-2006   #5
VSDan
Supporter
Moderator
 
VSDan's Avatar
 
Join Date: Sep 2005
Location: Vancouver, BC, Canada
Posts: 1,180
Default

You can try this:

1. Edit main.php by adding the following code towards the end just before the $tpl->assign('category', $path[count($path) - 1]); line:

Code:
$id = 0;
$rs = $db->Execute("SELECT * FROM `{$tables['category']['name']}` WHERE `STATUS` = 2 AND PARENT_ID = ".$db->qstr($id)." ORDER BY `TITLE`");
while (!$rs->EOF) {
   $row = $rs->FetchRow();
   if ($id == 0 && CATS_PREVIEW > 0) {
      $rs2 = $db->SelectLimit("SELECT * FROM `{$tables['category']['name']}` WHERE `STATUS` = 2 AND `SYMBOLIC` <> 1 AND `PARENT_ID` = ".$db->qstr($row['ID'])." ORDER BY `HITS` DESC, `TITLE` ", CATS_PREVIEW);
      $row['TSUBCATS'] = $rs2->GetRows();
      $rs2->Close();
   }
   if (ENABLE_REWRITE && empty ($row['TITLE_URL'])) {
      $row['TITLE_URL'] = preg_replace('`[^\w_-]`', '_', $row['TITLE']);
      $row['TITLE_URL'] = str_replace('__', '_', $row['TITLE_URL']);
   }
   $row['COUNT'] = $db->GetOne("SELECT COUNT(*) FROM `{$tables['category']['name']}` WHERE `STATUS` = 2 AND `PARENT_ID` = ".$db->qstr($row['ID']));
   $row['COUNT'] += $db->GetOne("SELECT COUNT(*) FROM `{$tables['link']['name']}` WHERE `STATUS` = 2 AND `CATEGORY_ID` = ".$db->qstr($row['ID']));
   if ($row['SYMBOLIC'] == 1) {
      $row['ID'] = $row['SYMBOLIC_ID'];
      $tempcat = $db->GetRow("SELECT * FROM `{$tables['category']['name']}` WHERE `ID` = ".$db->qstr($row['SYMBOLIC_ID']));
      if (empty($row['TITLE'])) { $row['TITLE'] = $tempcat['TITLE']; }
      $row['TITLE'] = "@" . $row['TITLE'];
   }
   $tcategs[] = $row;
}
2. Edit main.php by adding the following code towards the end just after the $tpl->assign('categs', $categs); line:

Code:
$tpl->assign('tcategs', $tcategs);
3. Edit footer.tpl by adding the following wherever you want the categories to appear:

Code:
{if count($path) != 1}
<center>
{foreach from=$tcategs item=cat name=tcategs}
{$cat.TITLE}{/if}
{if ($smarty.foreach.tcategs.iteration mod 10 eq 0) or $smarty.foreach.tcategs.last}
{/if}
{/foreach}
</center>
{/if}
Worked when I tested on our server.
__________________
Dan

Unlock the Vault Contest :: Over $350 Prizes!
phpLD Mods :: phpLD_Vault
Webmaster Resources Directory
phpLD_Vault Support

IMPORTANT NOTE:
phpLD_Vault Support not handled in this forum AND not via PM here. Click on link above for support. NO exceptions!
VSDan is offline  
Old 04-14-2006   #6
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

i did the changes in index.php an then i get an error:

Fatal error: Call to a member function on a non-object in /www/htdocs/w005f2ae/index.php on line 155

$row['TSUBCATS'] = $rs2->GetRows();

i this an error for an older version i had (RC 5.2)
i think i have the version before Rev. 76

how can i update to version 2.0 ? (i modded a lot of files.)

thanks for that work and thanks for helping me.
__________________
many thanks.

thompson.
thompson is offline  
Old 04-15-2006   #7
VSDan
Supporter
Moderator
 
VSDan's Avatar
 
Join Date: Sep 2005
Location: Vancouver, BC, Canada
Posts: 1,180
Default

Can you send me your index.php file.
__________________
Dan

Unlock the Vault Contest :: Over $350 Prizes!
phpLD Mods :: phpLD_Vault
Webmaster Resources Directory
phpLD_Vault Support

IMPORTANT NOTE:
phpLD_Vault Support not handled in this forum AND not via PM here. Click on link above for support. NO exceptions!
VSDan is offline  
Old 04-17-2006   #8
thompson
Supporter
 
Join Date: Oct 2005
Posts: 548
Default

you got pm.
__________________
many thanks.

thompson.
thompson is offline  
Old 04-19-2006   #9
Neticus
Supporter
 
Neticus's Avatar
 
Join Date: Dec 2005
Posts: 487
Default

Hi, I've just attempted this mod to see how it would look.

One problem I am having is that the categories display in a single column even though I have set for 3 coulmn
display. I have tried it on an unaffected phpld install with no template edits and still the same. Any suggestions on
why this could be? Perhaps it's missing the 'column display' code. I also took out the <center> tags just to check.
Any thoughts appreciated.

p.s. I have tried this in v2 but it also works in v303 which is my main install.

Thanks
Neticus is offline  
Old 04-19-2006   #10
VSDan
Supporter
Moderator
 
VSDan's Avatar
 
Join Date: Sep 2005
Location: Vancouver, BC, Canada
Posts: 1,180
Default

I revised the footer.tpl code to match what was finally done - this was handled in large part via PM.
__________________
Dan

Unlock the Vault Contest :: Over $350 Prizes!
phpLD Mods :: phpLD_Vault
Webmaster Resources Directory
phpLD_Vault Support

IMPORTANT NOTE:
phpLD_Vault Support not handled in this forum AND not via PM here. Click on link above for support. NO exceptions!
VSDan is offline  
Old 04-19-2006   #11
Neticus
Supporter
 
Neticus's Avatar
 
Join Date: Dec 2005
Posts: 487
Default

I see the design has changed for practicality of post subject. Is there anyway to keep the previous footer code yet have it follow the column structure like on index.php? What I'm really trying to do is call the top categories to a totally new page I've created.

thanks
Neticus is offline  
Old 04-19-2006   #12
VSDan
Supporter
Moderator
 
VSDan's Avatar
 
Join Date: Sep 2005
Location: Vancouver, BC, Canada
Posts: 1,180
Default

In the original code, try removing the <h3>/</h3> tags.
__________________
Dan

Unlock the Vault Contest :: Over $350 Prizes!
phpLD Mods :: phpLD_Vault
Webmaster Resources Directory
phpLD_Vault Support

IMPORTANT NOTE:
phpLD_Vault Support not handled in this forum AND not via PM here. Click on link above for support. NO exceptions!
VSDan is offline  
Old 04-19-2006   #13
Neticus
Supporter
 
Neticus's Avatar
 
Join Date: Dec 2005
Posts: 487
Default

Hi VSDan

I managed to find resolution The 'Calculate the number of categories per row' was the missing culprit.
I also had to follow your example and place 't' before 'categs'. This also had to be done for the 'categs' codes
in the very last {if...} statement line.

Code:
{* Calculate the number of categories per row *}
{php}
$this->assign('cats_per_col', ceil(count($this->get_template_vars('tcategs'))/ CATS_PER_ROW));
{/php}

{if count($path) != 1}
<table border="0" cellpadding="0" cellspacing="2"><tr> 
{foreach from=$tcategs item=cat name=tcategs} 
   {if ($smarty.foreach.tcategs.iteration mod $cats_per_col eq 1 and $cats_per_col gt 1) or $smarty.foreach.tcategs.first}<td>{/if} 
   <h2>{$cat.TITLE}{if $smarty.const.CATS_COUNT} <span class="count">({$cat.COUNT})</span>{/if}</h2> 

   {* Display subcategories *} 
   {if !empty($cat.TSUBCATS)} 
   <p class="subcats"> 
   {if $cat.TSUBCATS} 
      {foreach from=$cat.TSUBCATS item=scat name=scategs} 
      <a href="{if $smarty.const.ENABLE_REWRITE}{$cat.TITLE_URL}/{$scat.TITLE_URL}/{else}index.php?c={$scat.ID}{/if}"> 
      {$scat.TITLE}</a>, {/foreach} ... 
   {/if} 
   </p> 
   {/if} 
   {if ($smarty.foreach.tcategs.iteration mod $cats_per_col eq 0 and $cats_per_col gt 1) or $smarty.foreach.tcategs.last}</td>{/if} 
{/foreach} 
</tr></table>
{/if}
Much thanks for your initial post guide.

For anyone finding this in future and for whatever purposes you wish to use this discussion for, the above
code is taken from main.tpl.

Cheers
Net.
Neticus is offline  
Old 06-24-2006   #14
shzor
 
Join Date: Jan 2006
Posts: 394
Default

Hi did any one use this ..if yes then plz show me
__________________
Please check your signature links. They appear to be broken.
shzor is offline  
Old 06-29-2006   #15
Tim_Myth
 
Join Date: Oct 2005
Location: Polar Regions
Posts: 254
Default

I am getting this same error. How was it finally corrected? I simply copied and pasted the code from VSDan's post, excepting the part where the forum automatically created the hyperlink. BTW, I am using the latest release of phpLD2.
__________________
Free PHP Link Directory 3.xx templates - Why settle for screenshots and thumbnails when you can test drive them?
My Mods
4 lifetime links on seperate IPs for $5

Last edited by David; 08-18-2009 at 07:37 PM.
Tim_Myth is offline  
Old 08-10-2006   #16
Nerz
 
Join Date: Aug 2006
Posts: 118
Default

Anyone get this code working for 3.06. Im not getting any errors, but rather than having all the categories listed in the footer. I just want the top level categories listed, from left to right. I have 18 top level cats in all.
Nerz is offline  
Old 08-10-2006   #17
Steven Myers
Supporter
 
Steven Myers's Avatar
 
Join Date: May 2006
Posts: 1,178
Default

No luck here on 3.06 Final, I get this error when implimenting to the footer.tpl

Fatal error: Smarty error: [in footer.tpl line 39]: syntax error: mismatched tag {/if}. expected {/foreach} (opened line 38). (Smarty_Compiler.class.php, line 2289) in /home/fastline/public_html/libs/smarty/Smarty.class.php on line 1095
__________________
Hosting Feedback - General Web Directory
Steven Myers is offline  
Old 08-10-2006   #18
mikedippel
 
mikedippel's Avatar
 
Join Date: Sep 2005
Location: Pembroke Pines, FL
Posts: 219
Default

If I understand correctly, you can do what I do. Create a file called footer2.tpl and assign it to any php file you do not want to show the normal categories for. Just replace the last line of those files with footer2.tpl instead of footer.tpl
__________________
Michael Dippel
http://hobbyline.com - http://regionaldirectory.biz/ (running Beta 3) - http://daviefla.biz - http://directorylist.info
mikedippel is offline  
Old 08-10-2006   #19
Nerz
 
Join Date: Aug 2006
Posts: 118
Default

Mmm what im really after is just the top level categories in the footer in all pages, APART from the frontpage (cause there already there)..so the code above just needs to be modified to only show top level cats, but im lost on coding.
Nerz is offline  
Old 08-10-2006   #20
anon
Supporter
 
anon's Avatar
 
Join Date: Feb 2006
Location: As far from you as humanly possible!
Posts: 2,893
Send a message via Yahoo to anon
Default

Quote:
Originally Posted by Nerz
Mmm what im really after is just the top level categories in the footer in all pages, APART from the frontpage (cause there already there)..so the code above just needs to be modified to only show top level cats, but im lost on coding.
change this line:
$rs = $db->Execute("SELECT * FROM `{$tables['category']['name']}` WHERE `STATUS` = 2 AND PARENT_ID = ".$db->qstr($id)." ORDER BY `TITLE`");

to this:

$rs = $db->Execute("SELECT * FROM `{$tables['category']['name']}` WHERE `STATUS` = 2 AND PARENT_ID = 0 ORDER BY `TITLE`");
anon is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:59 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.