![]() |
| |||||||
| 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. |
![]() |
| | Thread Tools | Display Modes |
| | #1 |
| Supporter Join Date: Oct 2005 Posts: 548 | 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. |
| |
| | #2 |
| Join Date: Sep 2005 Posts: 678 | 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 |
| |
| | #3 |
| Supporter Join Date: Oct 2005 Posts: 548 | i wanna do it by myself. if you like, please post the code. __________________ many thanks. thompson. |
| |
| | #4 |
| Supporter Join Date: Oct 2005 Posts: 548 | *push* __________________ many thanks. thompson. |
| |
| | #5 |
| Supporter Moderator Join Date: Sep 2005 Location: Vancouver, BC, Canada Posts: 1,180 | 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;
} Code: $tpl->assign('tcategs', $tcategs); 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} __________________ 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! |
| |
| | #6 |
| Supporter Join Date: Oct 2005 Posts: 548 | 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. |
| |
| | #7 |
| Supporter Moderator Join Date: Sep 2005 Location: Vancouver, BC, Canada Posts: 1,180 | 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! |
| |
| | #8 |
| Supporter Join Date: Oct 2005 Posts: 548 | you got pm. __________________ many thanks. thompson. |
| |
| | #9 |
| Supporter Join Date: Dec 2005 Posts: 487 | 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 |
| |
| | #10 |
| Supporter Moderator Join Date: Sep 2005 Location: Vancouver, BC, Canada Posts: 1,180 | 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! |
| |
| | #11 |
| Supporter Join Date: Dec 2005 Posts: 487 | 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 |
| |
| | #12 |
| Supporter Moderator Join Date: Sep 2005 Location: Vancouver, BC, Canada Posts: 1,180 | 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! |
| |
| | #13 |
| Supporter Join Date: Dec 2005 Posts: 487 | 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} ![]() 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. |
| |
| | #14 |
| Join Date: Jan 2006 Posts: 394 | Hi did any one use this ..if yes then plz show me __________________ Please check your signature links. They appear to be broken. |
| |
| | #15 |
| Join Date: Oct 2005 Location: Polar Regions Posts: 254 | 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. |
| |
| | #16 |
| Join Date: Aug 2006 Posts: 118 | 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. |
| |
| | #17 |
| Supporter Join Date: May 2006 Posts: 1,178 | 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 |
| |
| | #18 |
| Join Date: Sep 2005 Location: Pembroke Pines, FL Posts: 219 | 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 |
| |
| | #19 |
| Join Date: Aug 2006 Posts: 118 | 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. |
| |
| | #20 | |
| Supporter | Quote:
$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`"); __________________ DirectoryDump Web Directory | Link Directory | Full of Search Web Directory | Free phpLD Templates | |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|