Jump to content

Revise link boxes


nlandgraf

Recommended Posts

I have two boxes on the side of a webpage: a platform box and a category box.  I want to combine the two boxes so that when you click on a certain platform, all categories from that plaform will then show underneath the platform.  My category box is set up that when you click the category any subcategories show up underneath it.  I have not been able to add the platform as the first level of this though.  Below is my code for the platform box, followed by the category box.

 

<? if($_REQUEST['item_type']=='G') { ?>

<div class="right-box-col">

 

 

<div class="<? if($boxside == 'Left') { ?>left-n-h-bg<? } else { ?>left-n-h-bg<? }?>" style="text-align:<?=$settings['LayoutBoxHeaderLayout'];?>"><?=$ObjBox->GetBoxheader();?></div>

<ul style="list-style:none;">

<?

 

$Itemtype = 'G';

 

 

$Platform2Obj = new Platform('', $DB);

$PlatformObj =  $Platform2Obj->GetAll();

foreach($PlatformObj as $ObjPlatform)

{

 

if(count($Platform2Obj) > 0)

{

if($settings['Safe_Urls'])

{

$Platformlink = "GameCatelog/".$Platform2Obj->GetPlatformid()."_".$Platform2Obj->GetTitle().".html";

}

else

{

$Platformlink = "index.php?view=catalog&item_type=".$Itemtype."&pfid=".$ObjPlatform->GetPlatformid();

}

}

 

 

?>

 

<li style="padding-top:5px;"><a  href="<?=$Platformlink?>"><?=$ObjPlatform->GetTitle();?></a></li>

 

<?

 

}

?>

</ul>

</div>

<? } ?>

 

Here is the code for the category box. 

 

<? if($_REQUEST['item_type']=='G' )

{

if($_REQUEST['pfid'])

$show = true;

else

$show = false;

}

else

$show = true;

if($show)

{

?>

 

 

<div class="title-menu"  >

<?=$ObjBox->GetBoxheader();?></div>

<ul id="MenuBar2" class="MenuBarVertical">

<?

if($_REQUEST['item_type']=='G')

$Itemtype = 'G';

else

$Itemtype = 'M';

 

if ($Itemtype=="M")

$allgenrelink="index.php?view=catalog&item_type=M";

else if ($Itemtype=="G")

$allgenrelink="index.php?view=catalog&item_type=G";

 

if($_REQUEST['pfid'])

{

$Platform2Obj = new Platform($_REQUEST['pfid'],$DB);

?>

<li class="boxplatformhead"><?=$Platform2Obj->GetTitle();?></li>

<? } ?>

<li><a href="<?=$allgenrelink?>"><b>All Genres</b></a></li>

<?

if($_REQUEST['cat_id'])

{

$currentcatobj = new Category($_REQUEST['cat_id'], $DB);

$currentcatparent = $currentcatobj->GetParentid();

}

$CategoryObj1 = new Category('', $DB);

$CategoryObj =  $CategoryObj1->GetAllparentfromItemType($Itemtype,'','');

foreach($CategoryObj as $ObjCategory)

{

 

if(count($Platform2Obj) > 0)

{

if($settings['Safe_Urls'])

{

$catlink = "GameCatelog/".$Platform2Obj->GetPlatformid()."_".$Platform2Obj->GetTitle()."_".$ObjCategory->GetCategoryid()."_".$ObjCategory->GetCategorynm().".html";

}

else

{

$catlink = "index.php?view=catalog&item_type=".$Itemtype."&pfid=".$Platform2Obj->GetPlatformid()."&cat_id=".$ObjCategory->GetCategoryid();

}

}

else

{

if($settings['Safe_Urls'])

{

$catlink = "Category/GameCatelog/".$ObjCategory->GetCategoryid()."_".$ObjCategory->GetCategorynm().".html";

}

else

{

$catlink = "index.php?view=catalog&item_type=".$Itemtype."&cat_id=".$ObjCategory->GetCategoryid(); } }

?>

 

<li ><a <? if($_REQUEST['cat_id'] == $ObjCategory->GetCategoryid()) { ?>class="current"<? } ?> href="<?=$catlink?>"><?=$ObjCategory->GetCategorynm();?></a></li>

 

<?

if($_REQUEST['cat_id'] == $ObjCategory->GetCategoryid())

$currentparent = $_REQUEST['cat_id'];

elseif($currentcatparent == $ObjCategory->GetCategoryid())

$currentparent = $currentcatparent;

if(($_REQUEST['cat_id'] == $ObjCategory->GetCategoryid() || $currentcatparent == $ObjCategory->GetCategoryid()) && $Itemtype == 'M')

{

$SubCategoryObj =  $CategoryObj1->GetAllfromParent($currentparent);

if($SubCategoryObj)

{

?>

 

<?

foreach($SubCategoryObj as $ObjSubCategory)

{

if($settings['Safe_Urls'])

{

$subcatlink = "Category/GameCatelog/".$ObjSubCategory->GetCategoryid()."_".$ObjSubCategory->GetCategorynm().".html";

}

else

{

$subcatlink = "index.php?view=catalog&item_type=".$Itemtype."&cat_id=".$ObjSubCategory->GetCategoryid();

}

?>

<li><a  href="<?=$subcatlink?>">    <?=$ObjSubCategory->GetCategorynm();?></a></li>

<?

}

?>

<?

}

}

}

?>

</ul>

</div>

<? } ?>

Link to comment
https://forums.phpfreaks.com/topic/184562-revise-link-boxes/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.