Go Back   PHP Link Directory Forum > PHP Link Directory (phpLD) > Support (Version 2)

Support (Version 2) Here is where we provide limited support for version 2. If you are seeking support for version 3 please post in the phpLD 3.0 Support Forum.

Closed Thread
 
Thread Tools Display Modes
Old 09-14-2005   #1
Wenchie
 
Join Date: Sep 2005
Location: Alabama
Posts: 15
Send a message via Yahoo to Wenchie
Default Category Dropdown - Submit Page

Hi there,

If this is already here somewhere I apologize. I swear I searched for the answer before posting.

On the Submit Link page can the pipe and underscore...

|__Whatever

be removed from the Category dropdown menu? If so can you tell me what file I need to edit?

Thank you!
__________________
Wenchie
Wenchie is offline  
Old 09-14-2005   #2
yktan
 
Join Date: Jun 2005
Posts: 353
Default

Hi Wenchie,

No worries, this question has never been asked before this. To totally remove the category indentation, do this:

Open \include\functions.php
Find:
Code:
function get_categs_tree($db, $id) {
	global $tables;
	static $categs = array ("0" => "[Top]");
	static $level = 0;
	$level ++;
	$rs = $db->Execute("SELECT ID, TITLE FROM {$tables['category']['name']} WHERE PARENT_ID = $id and SYMBOLIC <> 1 ORDER BY TITLE");
	while (!$rs->EOF) {
		$categs[$rs->Fields('ID')] = str_repeat('|', $level -1).'|___'.$rs->Fields('TITLE');
		get_categs_tree($db, $rs->Fields('ID'));
		$rs->MoveNext();
	}
	$level --;
	return $categs;
}
Replace with:
Code:
function get_categs_tree($db, $id) {
	global $tables;
	static $categs = array ("0" => "[Top]");
	static $level = 0;
	$level ++;
	$rs = $db->Execute("SELECT ID, TITLE FROM {$tables['category']['name']} WHERE PARENT_ID = $id and SYMBOLIC <> 1 ORDER BY TITLE");
	while (!$rs->EOF) {
		$categs[$rs->Fields('ID')] = $rs->Fields('TITLE');
		get_categs_tree($db, $rs->Fields('ID'));
		$rs->MoveNext();
	}
	$level --;
	return $categs;
}
This is based on PHPLD Rev 76. If you have an older version, the function might look slightly different but I'm sure you can implement the changes just as well.

Regards,
York Kie
__________________
Greatest fear in a coder\'s world: A minute bug with correct syntax.
{link removed from sig as the account seemed to be suspended}
yktan is offline  
Old 09-14-2005   #3
Wenchie
 
Join Date: Sep 2005
Location: Alabama
Posts: 15
Send a message via Yahoo to Wenchie
Default

Ahhh.. thank you so much!

Worked perfectly.

I really appreciate your help, and I love this directory. Everything with it has gone so smoothly. I can't begin to tell you how many I have tried to work with that haven't.

Great work!
__________________
Wenchie
Wenchie is offline  
Old 09-14-2005   #4
yktan
 
Join Date: Jun 2005
Posts: 353
Default

Hi Wenchie, you're most welcome. Have fun with PHPLD

Regards,
York Kie
__________________
Greatest fear in a coder\'s world: A minute bug with correct syntax.
{link removed from sig as the account seemed to be suspended}
yktan is offline  
Old 03-02-2006   #5
tarheit
Supporter
 
Join Date: Jan 2006
Location: Ohio
Posts: 23
Default

Here is a version that will list the categories as:
  • Category1 > Sub1
    Category1 > Sub2
    Category2
    Category3 > Sub1 > Sub1
    Category3 > Sub1 > Sub2
    etc...

It is based on version 2.0.0 RC5.2
(Perhaps this and the above alternate category listings could be a feature of version 3)

Code:
function get_categs_tree($db, $id, $previous='') {
    global $tables;
    static $categs = array ("0" => "[Top]");
    static $level = 0;
    $level ++;
    $rs = $db->Execute("SELECT ID, TITLE FROM {$tables['category']['name']} WHERE PARENT_ID = $id and SYMBOLIC <> 1 ORDER BY TITLE");

    while (!$rs->EOF) {
        if (empty($_SESSION['user_id']) ||$_SESSION['is_admin']) {
            $categs[$rs->Fields('ID')] =  $previous . $rs->Fields('TITLE');
        } else {
            if (in_array($rs->Fields('ID'),$_SESSION['user_permission_array'])){
                $categs[$rs->Fields('ID')] = $previous . $rs->Fields('TITLE');
            }
        }
        get_categs_tree($db, $rs->Fields('ID'), $previous . $rs->Fields('TITLE') . ' > ');

        $rs->MoveNext();
    }
    $level --;
    return $categs;
}
-Tim
__________________
Honey Run Apiaries
tarheit is offline  
Old 03-05-2006   #6
Shadowess
 
Join Date: Mar 2006
Posts: 1
Default

Hiya!
I've tried both of the suggestions above and I keep getting an error:

Parse error: parse error, unexpected T_STRING in /include/functions.php on line 101

I was actually wondering, since you have figured out how to get rid of the category dropdown pipeline thing and have modifed it, how to change some things.

I would like to have my main categories in bold.
I would also like to have it set up like

Main Category
-Sub Category


Or something similar. I have been tinkering with this for a while and I haven't been able to effect only the Main category listing....(or only the subcat for that matter.)

Any help would be great!
~Shadowess
Shadowess is offline  
Old 03-22-2006   #7
fsmedia
Supporter
 
Join Date: Feb 2006
Posts: 103
Default

is there an updated version of this for 3.0 or will it work out of the box?
fsmedia is offline  
Old 05-23-2006   #8
alang
 
Join Date: May 2006
Posts: 85
Default

Quote:
Originally Posted by tarheit
Here is a version that will list the categories as:
  • Category1 > Sub1
    Category1 > Sub2
    Category2
    Category3 > Sub1 > Sub1
    Category3 > Sub1 > Sub2
    etc...

It is based on version 2.0.0 RC5.2
(Perhaps this and the above alternate category listings could be a feature of version 3)

Code:
function get_categs_tree($db, $id, $previous='') {
    global $tables;
    static $categs = array ("0" => "[Top]");
    static $level = 0;
    $level ++;
    $rs = $db->Execute("SELECT ID, TITLE FROM {$tables['category']['name']} WHERE PARENT_ID = $id and SYMBOLIC <> 1 ORDER BY TITLE");

    while (!$rs->EOF) {
        if (empty($_SESSION['user_id']) ||$_SESSION['is_admin']) {
            $categs[$rs->Fields('ID')] =  $previous . $rs->Fields('TITLE');
        } else {
            if (in_array($rs->Fields('ID'),$_SESSION['user_permission_array'])){
                $categs[$rs->Fields('ID')] = $previous . $rs->Fields('TITLE');
            }
        }
        get_categs_tree($db, $rs->Fields('ID'), $previous . $rs->Fields('TITLE') . ' > ');

        $rs->MoveNext();
    }
    $level --;
    return $categs;
}
-Tim
is this work with the latest 3.05 version? I'd checked the code is slightly different.
alang is offline  
Old 07-06-2006   #9
CyberGrenade
 
Join Date: Jul 2006
Posts: 13
Default Thanks!

Thanks for the MOD. Works great....
__________________
http://www.cybergrenade.com

I also enjoy photography.
CyberGrenade is offline  
Old 08-19-2006   #10
mmastation
Mentor
Supporter
 
mmastation's Avatar
 
Join Date: May 2006
Location: San Diego, California
Posts: 523
Default

awesome. this works great. thank you. using it on both my directories.

Last edited by mmastation; 08-19-2006 at 08:27 PM.
mmastation is offline  
Old 09-07-2006   #11
jharri26
 
Join Date: Oct 2005
Posts: 33
Default

I tried the mod and got Fatal error: Call to a member function on a non-object in /home/gamhoo/public_html/include/functions.php on line 109 which is $categs[$rs->Fields('ID')] = $previous . $rs->Fields('TITLE');/ I am using the latest directory software. Any help would be good, thanks
jharri26 is offline  
Old 10-01-2006   #12
Dudley
 
Join Date: Apr 2006
Location: At my PC
Posts: 90
Default

Does anyone know how to get this to work with 3.06?

3.06 uses a different function

Code:
function get_regular_categs_tree($id=0)
{
   global $db, $tables;
   static $categs = array ("0" => "[Top]");
   static $level = 0;
   $level++;
   $rs = $db->Execute("SELECT `ID`, `TITLE` FROM `{$tables['category']['name']}` WHERE `PARENT_ID` = ".$db->qstr($id)." AND `STATUS` = '2' AND `SYMBOLIC` <> '1' ORDER BY `TITLE`");

   while (!$rs->EOF)
   {
      $categs[$rs->Fields('ID')] = str_repeat ('|&nbsp;&nbsp;&nbsp;', $level -1).'|___'.$rs->Fields('TITLE');
      get_regular_categs_tree($rs->Fields('ID'));
      $rs->MoveNext();
   }
   $level--;

   return $categs;
}
I tried modifying it in a similar manner to tarheit's example, but it doesn't work and causes a fatal error. Here is the modified code that does NOT work. What am I doing wrong?
Code:
function get_regular_categs_tree($id=0,$previous='')
{
   global $db, $tables;
   static $categs = array ("0" => "[Top]");
   static $level = 0;
   $level++;
   $rs = $db->Execute("SELECT `ID`, `TITLE` FROM `{$tables['category']['name']}` WHERE `PARENT_ID` = ".$db->qstr($id)." AND `STATUS` = '2' AND `SYMBOLIC` <> '1' ORDER BY `TITLE`");

   while (!$rs->EOF)
   {
      $categs[$rs->Fields('ID')] = $previous . $rs->Fields('TITLE');
      get_regular_categs_tree($db, $rs->Fields('ID'), $previous . $rs->Fields('TITLE') . ' > ');
      $rs->MoveNext();
   }
   $level--;

   return $categs;
}
I don't see what the $previous variable is supposed to do in tarheit's example, because a value is never assigned to it. It appears like it is supposed to pick up the main category name, but it is never assigned.
Dudley is offline  
Old 10-01-2006   #13
Boby
Supporter
Moderator
 
Boby's Avatar
 
Join Date: Dec 2005
Location: Cluj-Napoca/Sighisoara (Romania)
Posts: 4,468
Default

There is an error, when you call the function again withing the function:
PHP Code:
get_regular_categs_tree($db$rs->Fields('ID'), $previous $rs->Fields('TITLE') . ' > '); 
you are using the first parameter ($db) wrong, that is a deprecated param.

Use this:
PHP Code:
function get_regular_categs_tree($id=0,$previous='')
{
   global 
$db$tables;

   static 
$categs = array ("0" => "[Top]");
   static 
$level 0;
   
$level++;
   
$rs $db->Execute("SELECT `ID`, `TITLE` FROM `{$tables['category']['name']}` WHERE `PARENT_ID` = ".$db->qstr($id)." AND `STATUS` = '2' AND `SYMBOLIC` <> '1' ORDER BY `TITLE`");

   while (!
$rs->EOF)
   {
      
$categs[$rs->Fields('ID')] = $previous $rs->Fields('TITLE');
      
get_regular_categs_tree($rs->Fields('ID'), $previous $rs->Fields('TITLE') . ' > ');
      
$rs->MoveNext();
   }
   
$level--;

   return 
$categs;

__________________
wanna say thank you?
  • My phpLD Mods
  • I am *not* a phpLD staff member, so please do *not* ask me to grant permissions, sales stuff, for access to the private supporter forums or phpLD 3.0+ download area.
  • Before you report your problems, make sure it happens with the *default* package and not your highly modified code. Don't forget to use the search feature and do not *bump* threads to soon (allow at least 24h).
Boby is offline  
Old 10-01-2006   #14
Dudley
 
Join Date: Apr 2006
Location: At my PC
Posts: 90
Default

Works great! You da man, Boby!

I assumed the problem had to do with the recursion looping, but the error message had to do with memory allocation and didn't give me enough info to pinpoint the problem.
Dudley is offline  
Old 12-01-2006   #15
technomatters
 
Join Date: Nov 2006
Posts: 30
Default Disply pipes in admin

Hello All,

Thanks for the mode, but it is working at user side while submiting a link, but admin side its still showing the pipes model tree structure.

Anybody help me to figure out this.

Regards
Venkat
technomatters is offline  
Old 03-09-2007   #16
xoom
 
Join Date: Nov 2006
Posts: 5
Default

Thanks a lot, The mod its great
xoom is offline  
Old 03-16-2007   #17
slincoln
 
Join Date: Aug 2006
Location: Anoka, Minnesota
Posts: 275
Default

Is this mod included in 3.11 or going to be in, 3.12?

Thank you....
slincoln is offline  
Old 06-10-2007   #18
alexito
 
Join Date: Apr 2007
Location: Epaña
Posts: 79
Default

I cant find this code:


function get_categs_tree($db, $id) {
global $tables;
static $categs = array ("0" => "[Top]");
static $level = 0;
$level ++;
$rs = $db->Execute("SELECT ID, TITLE FROM {$tables['category']['name']} WHERE PARENT_ID = $id and SYMBOLIC <> 1 ORDER BY TITLE");
while (!$rs->EOF) {
$categs[$rs->Fields('ID')] = str_repeat('|', $level -1).'|___'.$rs->Fields('TITLE');
get_categs_tree($db, $rs->Fields('ID'));
$rs->MoveNext();
}
$level --;
return $categs;
}


i'm using the version 3.0.5, can someone help me?
__________________

http://www.1000enlaces.com PAGE RANK 3
Webmaster,
1000enlaces.com
alexito is offline  
Old 06-26-2007   #19
alexito
 
Join Date: Apr 2007
Location: Epaña
Posts: 79
Default

ok, problem solved
__________________

http://www.1000enlaces.com PAGE RANK 3
Webmaster,
1000enlaces.com
alexito 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 07:26 PM.


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