Jump to content

help needed pulling text links into a navigation. please


ricky spires

Recommended Posts

hello.

 

i have a navigation which i downloaded from

http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-bullet.htm

and i would link to pull the information in from my db

 

this is the html

 

<div class="arrowlistmenu">

<h3 class="menuheader expandable">title</h3>

<ul class="categoryitems">
<li><a href="#">link</a></li>
</ul>

<h3 class="menuheader expandable">title</h3>
<ul class="categoryitems">
     <li><a href="#">link</a></li>
     <li><a href="#" class="subexpandable">nested title</a>
              <ul class="subcategoryitems" style="margin-left: 15px">
       <li><a href="#">title</a></li>
       </ul>
      </li>
<li><a href="#">title</a></li>
</ul>
<div>
</div>

 

 

in the database each link and title have there own parent id and level id

 

so for example:

 

$level

$parent_id

$title

$link

$url

ok. a little more information for you.

 

 

this is my function at the moment

 

$PHGlidA  is getting the groupList id

$PHLobA  is getting the list order by (id, A-Z etc)

$PHLodA  is getting the list direction by (ASC, DESC etc)

$PHtA      is getting the list type (Top Nav, Side Nav)

 

 

function listText($PHGlidA, $PHLobA, $PHLodA, $PHtA){			


// GET THE TEXT LANGUAGE ID

		$langBS = basicSettings::find_by_id(1);
		$langID = $langBS->language_id; 


// FIND LIST BY ORDER & PHGROUPS LISTid

		$PHLoa = PhLists::find_by_order($PHGlidA, $PHLobA, $PHLodA);
		foreach ($PHLoa as $PHLoas){
		$PHLidA = $PHLoas->id;
		$PHlvlA = $PHLoas->levels;
		$PHLdidA = $PHLoas->destination_id;
                         $PHLpidA = $PHLoas->parent_id;

// FIND LIST TEXT IDs BY THE LANGUAGE AND ID ABOVE

			$PCba = PCbridge::find_by_list($PHLidA, $langID);
			foreach ($PCba as $PCbas){
			$PCidA = $PCbas->pageContent_id;


// FIND LIST CONTENT BY PAGECONTENTid

                                        $PCa = PageContent::find_by_pageContID($PCidA);
				foreach ($PCa as $PCas){

				$title = $PCas->title;
				$link = $PCas->link;


// echo navigation here //


 

 

it pulls the right info i just cant put it in to my navigation

 

also i need the current page selected in bold

 

for that i was using this but it needs work

 

<li><a '.($pageID == $PHLdidA ? .'class="selected"' : '').' href="index.php?id='.echo $PHLdidA; .'">'. echo $nav2s->title; ?.'</a></li></h3>

 

that seems to be broke ...

 

thanks :)

a little more info for you.

 

this is how the text is structured

 

 

PHlist_ID

PCBridge_ID

pageContent_ID

parent

level

order No

title

link

destination

 

 

 

1

-

-

0

1

1

level1 - Title1

-

-

 

2

-

-

0

1

2

level1 - Title2

-

-

3

-

-

0

1

3

level1 - Title3

-

-

4

-

-

0

2

1

level2 - subTitle-1

-

-

5

-

-

0

2

2

level2 - subTitle2

-

-

6

-

-

1

1

1

-

level1 - link-1

-

7

-

-

1

1

2

-

level1 - link-2

-

8

-

-

2

1

1

-

level1 - link-3

-

9

-

-

2

1

2

-

level1 - link-4

-

10

-

-

4

2

1

-

level2 - link-5

-

11

-

-

4

2

2

-

level2 - link-6

-

12

-

-

3

1

1

-

level1 - link-7

-

13

-

-

3

1

2

-

level1 - link-8

-

14

-

-

5

2

1

-

level2 - link-9

-

15

-

-

5

2

2

-

level2 - link-10

-

 

 

 

 

 

 

 

 

 

 

 


<ul><li>Title-1</li>
       <li><a href="#">link-1</a></li>
       <li><a href="#">link-2</a></li>
</ul>
      
<ul>Title-2
       <li><a href="#">link-3</a></li>
       <li><a href="#">link-4</a></li>
            
             <ul>Sub-Title-1
             <li><a href="#">link-5</a></li>
             <li><a href="#">link-6</a></li>
             </ul>
</ul>

<ul>Title-3
       <li><a href="#">link-7</a></li>
       <li><a href="#">link-8</a></li>
            
             <ul>Sub-Title-2
             <li><a href="#">link-9</a></li>
             <li><a href="#">link-10</a></li>
             </ul>
</ul>

hello.

 

im have tried but totally stuck

 

how do i put my php in to a nested vertical navigation ?

 

this is my code so far

 

function listText($PHGlidA, $PHLobA, $PHLodA, $PHtA){			

// THIS PART GETS THE LANGUAGE
		$langBS = basicSettings::find_by_id(1);
		$langID = $langBS->language_id; 


// THIS PART GETS THE TEXT LEVELS, PARENTID AND DESTINATION IN ORDER
		$PHLoa = PhLists::find_by_order($PHGlidA, $PHLobA, $PHLodA);
		foreach ($PHLoa as $PHLoas){
		$PHLidA = $PHLoas->id;
		$PHstA = $PHLoas->style_id;
		$PHlvlA = $PHLoas->levels;
		$PHpntA = $PHLoas->parent_id;
		$PHLdidA = $PHLoas->destination_id;

// THIS PART GETS THE TEXT ID's by LANGUAGE AND LISTID
			$PCba = PCbridge::find_by_list($PHLidA, $langID);
			foreach ($PCba as $PCbas){
			echo "PCid = ".$PCidA = $PCbas->pageContent_id;

// THIS PART GETS THE TEXT BY PAGECONTENTid
				$PCa = PageContent::find_by_pageContID($PCidA);
				foreach ($PCa as $PCas){

                                        $title = $PCas->title;
				$link = $PCas->link;

 

so then i need to put the title, link and destination in the navigation

 

this is the original navigation

 

<ul class="categoryitems">
<li><a href="#">link</a></li>
</ul>

<h3 class="menuheader expandable">title</h3>
<ul class="categoryitems">
     <li><a href="#">link</a></li>
     <li><a href="#" class="subexpandable">nested title</a>
              <ul class="subcategoryitems" style="margin-left: 15px">
       <li><a href="#">title</a></li>
       </ul>
      </li>
<li><a href="#">title</a></li>
</ul>
<div>
</div>

 

 

i had a go at doing it like this... but it really did not work

 

echo'
<div class="arrowlistmenu">';

if ($PHlvlA == "1"){
echo'	
<h3 class="menuheader expandable">'.$title.'</h3>';

}else if ($PHlvlA == "2"){
echo'
<ul class="categoryitems">
<li><a href="'.$PHLdidA.'">'.$link.'</a></li>
</ul>';

}else if ($PHlvlA == "3"){
echo'
<ul class="subcategoryitems" style="margin-left: 15px">
<li><a href="'.$PHLdidA.'">'.$link.'</a></li>
</ul>';
}
echo'
</div>
';

 

 

please help

thanks

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.