help plz in PHP revers function for menu
|
Lagz_bagz |
Posted on 06-11-2014 11:02
|
Senior Member
Posts: 233
Joined: 01.12.09
|
Soory for shit english
mysql table - page: id,url,name,type_id
child type_id - id of parent
[img]http://i68.fastpic.ru/thumb/2014/1106/b5/24d10b00e3bc53541ecbf83d149599b5.jpeg[/img] is not a valid Image.
I mean i can't hide not selected category of menu, only show all
Edited by Lagz_bagz on 06-11-2014 11:10
|
|
|
|
Zax |
Posted on 06-11-2014 11:19
|
Super Admin
Posts: 595
Joined: 27.03.12
|
Uhmmmm.....errrr.......17? |
|
|
|
Lagz_bagz |
Posted on 06-11-2014 11:28
|
Senior Member
Posts: 233
Joined: 01.12.09
|
Zaxy, what u mean? |
|
|
|
Zax |
Posted on 06-11-2014 17:49
|
Super Admin
Posts: 595
Joined: 27.03.12
|
It means I have no idea
Is there not a php forum that you can maybe download scripts from other web designers? I'll have a look when I get home. |
|
|
|
mdmazing |
Posted on 06-11-2014 19:57
|
Senior Member
Posts: 285
Joined: 08.10.10
|
****s sake you never heard of Google? |
|
|
|
Lagz_bagz |
Posted on 06-11-2014 20:11
|
Senior Member
Posts: 233
Joined: 01.12.09
|
Pff, i ask it the Mock, wft u all come here?
In russ google dont find, english for me is too hard |
|
|
|
Lagz_bagz |
Posted on 06-11-2014 20:47
|
Senior Member
Posts: 233
Joined: 01.12.09
|
Ok, I find decision thread can close, TY all |
|
|
|
Zax |
Posted on 06-11-2014 22:39
|
Super Admin
Posts: 595
Joined: 27.03.12
|
Post the answer Lagz. Was it 17? |
|
|
|
Lagz_bagz |
Posted on 06-11-2014 22:47
|
Senior Member
Posts: 233
Joined: 01.12.09
|
Too hard to explain this shit :) i add array with parents tree in coll for all pages, then do this script
$res = mysql_query("SELECT parents,url FROM page WHERE url='".dataprocessing($params[0])."' LIMIT 1");
$r = mysql_fetch_array($res);
$mass = explode('|',$r['parents']);
function left_menus($array,$parent,$mass)
{
global $params;
foreach($array as $item)
{
if($item['type_id']!=$parent) continue;
$return .= '<a href="/'.$item['url'].'">'.$item['menu'].'</a>'."\n";
if(in_array($item['id'],$mass)) $return .= left_menus($array,$item['id'],$mass);
}
return $return;
}
$resultMenu = mysql_query("SELECT * FROM page ORDER BY menu");
$arrayMenu = array();
while($rowMenu = mysql_fetch_array($resultMenu))
{
$arrayMenu[] = $rowMenu;
}
:D |
|
|
|
mdmazing |
Posted on 07-11-2014 15:55
|
Senior Member
Posts: 285
Joined: 08.10.10
|
lmfao Lag you crack me up |
|
|
|
Lagz_bagz |
Posted on 08-11-2014 11:18
|
Senior Member
Posts: 233
Joined: 01.12.09
|
Mdm, this is my fkng job |
|
|
|
mdmazing |
Posted on 10-11-2014 15:49
|
Senior Member
Posts: 285
Joined: 08.10.10
|
Rather you than me bud ;-) |
|
|