Jump to content

ricky spires

Members
  • Posts

    171
  • Joined

  • Last visited

Everything posted by ricky spires

  1. ok... scrap that. this is all i need <?php $i=1; while($i<=5) { $no = (rand(1,5)); echo "The number is " . $no . "<br />"; $i++; } ?> that gives me 5 results showing a random number thanks
  2. hmmm. thanks for your comments. i think i need to have a second look at the code. ill keep you posted . thanks
  3. hello, could someone please help me with this array. what i what is 4 images displayed on the page which change randomly. each image has is own audio on hover and plays video on click (no included in this code). <?php function random_ads($no){ $number = array( "1", "2", "3", "4", ); for($y=0;$y<=$no;$y++){ $rand_no = array_rand($number, 2); $no=$number[$rand_no[1]]; $random_vid.=' <div id="videoHolder" class="vid'.$no.'"> <audio id="audio'.$no.'" preload="auto"> <source src="assets/audio/audio'.$no.'.mp3" type="audio/mpeg" ></source> <source src="assets/audio/audio'.$no.'.ogg" type="audio/ogg" ></source> </audio> <img src="assets/images/pic'.$no.'.jpg" alt="picture'.$no.'"> </div>'; } return $random_vid; } ?> <div id="heart"> <?php echo random_ads(4); // 2 = number of ads displayed ?> </div> i think im putting the wrong number in the brackets but it doesnt seem to work ? thanks ricky
  4. fixed it <p>{IMGno}/{noPics}</p> $noPics = count($aUnits); 'noPics' => $noPics thanks
  5. true.. but im my actuall code they are not missing this is the code: <? $sThumbTemplate = <<<HTML <li><a href="#" rel="nofollow" title="{title}"><img src="{fileurl}" alt="{title}" /></a></li> HTML; $sImageTemplate = <<<HTML <div class="sliderkit-panel"> <img src="{fileurl}" alt="{title}" /> <div class="sliderkit-panel-textbox"> <div class="sliderkit-panel-text"> <div class="arrow-left"><a rel="nofollow" href="#" title="Next line"></a></div> <p>{IMGno}/7</p> <div class="arrow-right"><a rel="nofollow" href="#" title="Next photo"></a></div> </div> <div class="sliderkit-panel-overlay"></div> </div> </div> HTML; $sThumbs = $sImages = ''; $sFolder = 'assets/img/slider/'; $aUnits = array( 'pic1.jpg' => '1', 'pic2.jpg' => '2', 'pic3.jpg' => '3', 'pic4.jpg' => '4', 'pic5.jpg' => '5', 'pic6.jpg' => '6', 'pic7.jpg' => '7' ); foreach ($aUnits as $sFileName => $sTitle) { $sThumbs .= strtr($sThumbTemplate, array('{fileurl}' => $sFolder . 't_' . $sFileName, '{title}' => $sTitle)); $sImages .= strtr($sImageTemplate, array('{fileurl}' => $sFolder . $sFileName, '{title}' => $sTitle, '{IMGno}' => $sTitle, '{id}' => $sID)); } header("Content-Type: application/json"); require_once('Services_JSON.php'); $oJson = new Services_JSON(); echo $oJson->encode(array('thumbs' => $sThumbs, 'images' => $sImages)); ?> if you look for <p>{IMGno}/7</p> at the top. i want to replace the 7 with the number of pics in the array
  6. hello. How do i count how many pics in this array? $aUnits = array('pic1.jpg => '1', 'pic2.jpg => '2', 'pic3.jpg => '3'); i tried this but its not working echo count($aUnits); thanks rick
  7. hello. how do i get how many 30's there are in x amount and then strip the remainder in 29 there is 0 in 59 there is 1
  8. ok. im not good with javascript. do you have an example please. thanks
  9. ok. so is there another way. i.e everytime the line of text goes on to another row increase the padding by 5px
  10. hello. i would like to increase css padding by 5px every time there is 30 charactures in the text. how can i do this ? this is what i have but its not any good . $length = (strlen($article->title)); $padding = 5; for ( $counter = 2; $counter <= 10; $counter += 10) { $amount = $padding * $counter; }
  11. hello i have some normal php functions that i want to put into a oop class. i cant seem to make the right changes to make it work. could some one help please. thanks these are the php functions <?php function hasChild($parent_id) { $sql = "SELECT COUNT(*) as count FROM category WHERE parent_id = '" . $parent_id . "'"; $qry = mysql_query($sql); $rs = mysql_fetch_array($qry); return $rs['count']; } function CategoryTree($list,$parent,$append) { $list = '<li>'.$parent['name'].'</li>'; if (hasChild($parent['id'])) // check if the id has a child { $append++; $list .= "<ul class='child child".$append."'>"; $sql = "SELECT * FROM category WHERE parent_id = '" . $parent['id'] . "'"; $qry = mysql_query($sql); $child = mysql_fetch_array($qry); do{ $list .= CategoryTree($list,$child,$append); }while($child = mysql_fetch_array($qry)); $list .= "</ul>"; } return $list; } function CategoryList() { $list = ""; $sql = "SELECT * FROM category WHERE (parent_id = 0 OR parent_id IS NULL)"; $qry = mysql_query($sql); $parent = mysql_fetch_array($qry); $mainlist = "<ul class='parent'>"; do{ $mainlist .= CategoryTree($list,$parent,$append = 0); }while($parent = mysql_fetch_array($qry)); $list .= "</ul>"; return $mainlist; } ?> this is the class <?PHP require_once(LIB_PATH.DS.'database.php'); class Menu extends DatabaseObject { protected static $table_name="menu"; protected static $db_fields = array( 'id', 'parent_id', 'name' ); public $id; public $parent_id; public $name; // "new" is a reserved word so we use "make"(or "build") public static function make( $id, $parent_id, $name) { if(!empty($id)) { $kw = new Menu(); $kw->id = (int)$id; $kw->parent_id = (int)$parent_id; $kw->name = $name; return $kw; }else{ return false; } } //end function make //PUT FUNCTIONS HERE...... function hasChild($parent_id) { $sql = "SELECT COUNT(*) as count FROM category WHERE parent_id = '" . $parent_id . "'"; $qry = mysql_query($sql); $rs = mysql_fetch_array($qry); return $rs['count']; } function CategoryTree($list,$parent,$append) { $list = '<li>'.$parent['name'].'</li>'; if (hasChild($parent['id'])) // check if the id has a child { $append++; $list .= "<ul class='child child".$append."'>"; $sql = "SELECT * FROM category WHERE parent_id = '" . $parent['id'] . "'"; $qry = mysql_query($sql); $child = mysql_fetch_array($qry); do{ $list .= CategoryTree($list,$child,$append); }while($child = mysql_fetch_array($qry)); $list .= "</ul>"; } return $list; } function CategoryList() { $list = ""; $sql = "SELECT * FROM category WHERE (parent_id = 0 OR parent_id IS NULL)"; $qry = mysql_query($sql); $parent = mysql_fetch_array($qry); $mainlist = "<ul class='parent'>"; do{ $mainlist .= CategoryTree($list,$parent,$append = 0); }while($parent = mysql_fetch_array($qry)); $list .= "</ul>"; return $mainlist; } ?>
  12. hello. sorry but i can't work it out. i gives me a list of headers but only the top header gives me any sub levels and its not giving me sub sub levels ... i just does not work. this is the db structure so it should look like this this is my code. <?PHP echo'<div class="arrowlistmenu">'; $navHead = PhLists::find_all(); foreach($navHead as $navHeads){ $headID = $navHeads->id; $headLevel = $navHeads->listLevel; //IF LEVEL IS HEADER if($headLevel == "header"){ echo'<li><a><h3 class="menuheader expandable">'.$navHeads->linkTitle.'</h3></a></li>'; }else{ echo' <ul class="categoryitems">'; $navLink = PhLists::find_by_child($headID); foreach($navLink as $navLinks){ $id = $navLinks->id; $PNT = $navLinks->parent_id; $Level = $navLinks->listLevel; //IF LEVEL IS LIST echo $Level == "list" ? '<li><a>'.$navLinks->linkTitle.'</a></li>' : $subLink = PhLists::find_by_child($id); foreach($subLink as $subLinks){ $subid = $subLinks->id; $subPNT = $subLinks->parent_id; $subLevel = $subLinks->listLevel; // IF LEVEL IS TITLE echo '<li><a href="#" class="subexpandable">'.$subLinks->linkTitle.'</a> <ul class="subcategoryitems" style="margin-left: 15px"> <li><a>'.$subLinks->linkTitle.'</a></li> </ul> </li>'; } } echo'</ul>'; } } echo'</div>'; ?> the function find_by_child($id); looks like this public static function find_by_child($child){ $sql = "SELECT * FROM ".self::$table_name." WHERE parent_id=".$child.""; $result_array = self::find_by_sql($sql); return $result_array; } any help would be great. thanks
  13. ok. i'm stuck at the first hurdle. this is the site: http://wizardinternetsolutions.com/web-database-design/single-query-dynamic-multi-level-menu/ im stuck getting to info from my database. this is they code they give: <?PHP // Select all entries from the menu table $result=mysql_query("SELECT id, label, link, parent FROM menu ORDER BY listparent, listsort, label"); // Create a multidimensional array to conatin a list of items and parents $menu = array( 'items' => array(), 'listparents' => array() ); // Builds the array lists with data from the menu table while ($items = mysql_fetch_assoc($result)) { // Creates entry into items array with current menu item id ie. $menu['items'][1] echo $menu['items'][$items['id']] = $items; // Creates entry into parents array. Parents array contains a list of all items with children echo $menu['listparents'][$items['listparent']][] = $items['id']; } ?> how can i change that code to work with my system. at the top i have <?PHP require_once("includes/initialize.php"); ?> which gets a the menu class which gets all the database stuff <?PHP require_once(LIB_PATH.DS.'database.php'); class Menu extends DatabaseObject { protected static $table_name="menu"; protected static $db_fields = array( 'id', 'label', 'link', 'linkparent', 'linksort'); public $id; public $label; public $link; public $linkparent; public $linksort; // "new" is a reserved word so we use "make"(or "build") public static function make( $id, $label, $link, $linkparent, $linksort) { if(!empty($id)) { $kw = new Menu(); $kw->id = (int)$id; $kw->label = $label; $kw->link = $link; $kw->linkparent = (int)$linkparent; $kw->linksort = (int)$linksort; return $kw; }else{ return false; } } //end function make public static function find_list(){ $sql = "SELECT id, label, link, linkparent FROM ".self::$table_name." ORDER BY linkparent, linksort, label"; $result_array = self::find_by_sql($sql); return !empty($result_array) ? array_shift($result_array) : false; } } note i had to change parent to linkparent and sort to linksort so from their code i guess i remove this line because its in my class $result=mysql_query("SELECT id, label, link, parent FROM menu ORDER BY listparent, listsort, label"); so how do i get the stuff out of the db into the while loop etc... thanks rick
  14. thanks for your replies. I have found an example online. i going to study that and play around with it to see if i can work it out. this is the example online that i found http://wizardinternetsolutions.com/web-database-design/single-query-dynamic-multi-level-menu/ thanks ricky
  15. hello. i finally got my nested list working but its only go 2 levels. how do i make it unlimited levels ? this is a nested list <ul> <li><a href="#">list</a></li> <li><a href="#" class="sub">sub title</a> <ul class="subcat" style="margin-left: 15px"> <li><a href="#">sub title</a></li> </ul> </li> </ul> this is not the actual code but this is how it works at the moment <ul> if($Level == "list"){ <li><a href="#">list</a></li> }elseif($Level == "subList"){ <li><a href="#" class="sub">sub title</a> <ul class="subcat" style="margin-left: 15px"> <li><a href="#">sub title</a></li> </ul> </li> } </ul>
  16. Hello. Im having trouble using a Tempory Operator in a list. maybe someone might know a way around it. so the list below has 3 Tempory Operators. the first 1 looks for pages with links that are internal links the first 2 looks for pages with links that are external links the first 3 looks for pages with links that have no links if the link is a "nonTitle" it will be a normal list item if the link is a "title" it will be a header for a sub list (class="subexpandable") the problem is that every time it gets to the '; at the end of each Tempory Operators it breaks THIS IS NOT WORKING <ul> //FIND INTERNAL LINKS echo $type == "internal" && $list == "nonTitle" ? '<li><a href="index.php">'.$title.'</a></li>' : '<li><a href="index.php" class="subexpandable">'.$title.'</a>'; //FIND EXTERNAL LINKS echo $type == "external" && $list == "nonTitle" ? '<li><a href="http://www.url.com">'.$title.'</a></li>' : '<li><a href="http://www.url.com" class="subexpandable">'.$title.'</a>'; //FIND NON LINKS echo $type == "non" && $list == "nonTitle" ? '<li><a>'.$title.'</a></li>' : '<li><a class="subexpandable">'.$title.'</a>'; //GET SUB LINKS echo' <ul class="subcategoryitems" style="margin-left: 15px"> <li><a href="">sub link</a></li> </ul> </li> </ul>'; If i put the sub level inside of each type it works but then i keep having to use the same code over. THIS IS WORKING <ul> //FIND INTERNAL LINKS echo $type == "internal" && $list == "nonTitle" ? '<li><a href="index.php">'.$title.'</a></li>' : '<li><a href="index.php" class="subexpandable">'.$title.'</a> <ul class="subcategoryitems" style="margin-left: 15px"> <li><a href="">sub link</a></li> </ul> </li>'; //FIND EXTERNAL LINKS echo $type == "external" && $list == "nonTitle" ? '<li><a href="http://www.url.com">'.$title.'</a></li>' : '<li><a href="http://www.url.com" class="subexpandable">'.$title.'</a> <ul class="subcategoryitems" style="margin-left: 15px"> <li><a href="">sub link</a></li> </ul> </li>'; //FIND NON LINKS echo $type == "non" && $list == "nonTitle" ? '<li><a>'.$title.'</a></li>' : '<li><a class="subexpandable">'.$title.'</a> <ul class="subcategoryitems" style="margin-left: 15px"> <li><a href="">sub link</a></li> </ul> </li>'; </ul>'; so is there a way to do the first example without having to do the second example thanks ricky
  17. hi all. no worries. i fixed it another way.. i add a column in the db called type.. so each item in the list could be set to title or link. that way the header for each nested levels could be set to "title" <?PHP require_once("includes/initialize.php"); ?> <?PHP echo' <div class="arrowlistmenu">'; $nav = PhLists::navOrder($PHLlno, $PHLorb, $PHLord); //FIND HEADER $navHead = PhLists::find_by_parentID(0); foreach($navHead as $navHeads){ $headID = $navHeads->id; $headLnk = $navHeads->pageLink_id; $PCBhead = PCbridge::find_NavText($headLnk, $langID); foreach ($PCBhead as $PCBheads){ $headText = $PCBheads->pageContent_id; $headText = PageContent::find_text($headText); foreach ($headText as $headTexts){ $header = $headTexts->title; echo $navPnt == 0 ? '<h3 class="menuheader expandable">'.$header.'</h3>' : ''; echo' <ul class="categoryitems">'; //FIND LINK & TITLES $navLink = PhLists::find_by_child($headID); foreach($navLink as $navLinks){ $nLid = $navLinks->id; $nLink = $navLinks->pageLink_id; $nLinkPnt = $navLinks->parent_id; $nLinklvl = $navLinks->level; $PCBlink = PCbridge::find_NavText($nLink, $langID); foreach ($PCBlink as $PCBlinks){ $linkText = $PCBlinks->pageContent_id; $lnkText = PageContent::find_text($linkText); foreach ($lnkText as $lnkTexts){ echo $nLinklvl == "Link" ? '<li><a href="">'.$lnkTexts->title.'</a></li>' : '<li><a href="" class="subexpandable">'.$lnkTexts->title.'</a>'; echo' <ul class="subcategoryitems" style="margin-left: 15px">'; //FIND SUBNAV SUBLINK $subNav = PhLists::find_by_child($nLid); foreach($subNav as $subNavs){ $sLinkID = $subNavs->pageLink_id; $sLinkPnt = $subNavs->parent_id; $sLinklvl = $navLinks->level; $PCBsubLink = PCbridge::find_NavText($sLinkID, $langID); foreach ($PCBsubLink as $PCBsubLinks){ $subLinkText = $PCBsubLinks->pageContent_id; $subLnkText = PageContent::find_text($subLinkText); foreach ($subLnkText as $subLnkTexts){ $subLink = $subLnkTexts->title; echo' <li><a href="">'.$subLink.'</a></li>'; }}} echo' </ul> </li>'; }}} echo'</ul>'; }}} echo'</div>'; ?> that did the trick. not what i wanted really but it works thanks
  18. im trying to say if $id has 1 or more $other_var with the same value as $id do something for example $id - $name - $parent_id 1 - title1 - 0 (parent) 2 - title2 - 0 (parent) 3 - link1 - 1 (child) 4 - link2 - 1 (child) 5 - link3 - 2 (child) 6 - link4 - 2 (child) 7 - link5 - 0 (just a link) 8 - link6 - 0 (just a link) so the above would be if $id has 1 or more $parent_id with the same id do something. i cant use if $id == $parent_id for this. its no good because im trying to set a nested level ------------------------------------------------ this is the actual code with the problem... the part that says "****THIS IS WHERE IM STUCK***" is where i need to put some code that says "if $id HAS ANY $parent_id with the same number make the li a title." <div> $header = Text::find_by_parentID(0); foreach ($header as $headers){ $Hid = $headers->id; $Hname = $headers->name; $Hparent = $headers->parent; echo $Hparent == 0 ? '<h3 class="header">'.$Hname.'</h3>' : ''; echo' <ul class="nav">'; //FIND NESTED TITLES / LINKS $headText = Text::find_by_child($Hid); foreach ($headText as $headTexts){ $Cid = $headTexts->id; $Cname = $headTexts->name; $Cparent = $headTexts->parent; echo ***THIS IS WHERE IS WANT THE CODE*** ? '<li><a href="">'.Cname.'</a></li>' : '<li><a href="" class="subTitle">'.Cname.'</a>'; echo' <ul class="subLevel" style="margin-left: 15px">'; //FIND SUBLINK $sub = Text::find_by_child($Cid); foreach ($subs $subs){ $name = $subs->name; echo'<li><a href="">'.$name.'</a></li>'; } echo' </ul> </li>'; } echo'</ul>'; } echo'</div>'; ?> so im trying to say if a <li> has and sub links the <li> that the $parent_id is pointing to becomes a title
  19. hello how would i write, if $a has 1 or more of $b do something ? for example if($a >1 $b){ do something }else{ do nothing } or >2 or >3 etc... thanks
  20. can anyone help with this please. ? all i what to do is find some code that says... if ID has ant CHILDREN do 1thing if not do another thing.. for example: $id - $name - $parent_id 1 - title1 - 0 (parent) 2 - title2 - 0 (parent) 3 - link1 - 1 (child) 4 - link2 - 1 (child) 5 - link3 - 2 (child) 5 - link4 - 2 (child) if $id HAS ANY $parent_id with the same number echo <li class="PARENT">'.$name'.</li> else echo <li class="CHILD">'.$name'.</li> any ideas..... this is the actual code .. the part that says "****THIS IS WHERE IM STUCK***" is where i need to put some code that says "if $id HAS ANY $parent_id with the same number make the li a title." <?PHP require_once("includes/initialize.php"); ?> <?PHP echo' <div class="arrowlistmenu">'; $nav = PhLists::navOrder($PHLlno, $PHLorb, $PHLord); //FIND HEADER $navHead = PhLists::find_by_parentID(0); foreach($navHead as $navHeads){ $headID = $navHeads->id; $headLnk = $navHeads->pageLink_id; $PCBhead = PCbridge::find_NavText($headLnk, $langID); foreach ($PCBhead as $PCBheads){ $headText = $PCBheads->pageContent_id; $headText = PageContent::find_text($headText); foreach ($headText as $headTexts){ $header = $headTexts->title; echo $navPnt == 0 ? '<h3 class="menuheader expandable">'.$header.'</h3>' : ''; echo' <ul class="categoryitems">'; //FIND LINK & TITLES $navLink = PhLists::find_by_child($headID); foreach($navLink as $navLinks){ $nLid = $navLinks->id; $nLink = $navLinks->pageLink_id; $nLinkPnt = $navLinks->parent_id; $nLinklvl = $navLinks->level; $PCBlink = PCbridge::find_NavText($nLink, $langID); foreach ($PCBlink as $PCBlinks){ $linkText = $PCBlinks->pageContent_id; $lnkText = PageContent::find_text($linkText); foreach ($lnkText as $lnkTexts){ echo ****THIS IS WHERE IM STUCK**** ? '<li><a href="">THIS IS A LINK='.$lnkTexts->title.'</a></li>' : '<li><a href="" class="subexpandable">THIS IS A TITLE='.$lnkTexts->title.'</a>'; echo' <ul class="subcategoryitems" style="margin-left: 15px">'; //FIND SUBNAV SUBLINK $subNav = PhLists::find_by_child($nLid); foreach($subNav as $subNavs){ $sLinkID = $subNavs->pageLink_id; $sLinkPnt = $subNavs->parent_id; $sLinklvl = $navLinks->level; $PCBsubLink = PCbridge::find_NavText($sLinkID, $langID); foreach ($PCBsubLink as $PCBsubLinks){ $subLinkText = $PCBsubLinks->pageContent_id; $subLnkText = PageContent::find_text($subLinkText); foreach ($subLnkText as $subLnkTexts){ $subLink = $subLnkTexts->title; echo' <li><a href="">THIS IS A SUBLINK='.$subLink.'</a></li>'; }}} echo' </ul> </li>'; }}} echo'</ul>'; }}} echo'</div>'; ?>
  21. ok. but say i have nested levels in the part that says ***THIS IS WHERE IS WANT THE CODE*** i want it to do some thing like .... if there are children pointing to an id make it a title of a nested level (class="subTitle) else its just a link in the list <div> $header = Text::find_by_parentID(0); foreach ($header as $headers){ $Hid = $headers->id; $Hname = $headers->name; $Hparent = $headers->parent; echo $Hparent == 0 ? '<h3 class="header">'.$Hname.'</h3>' : ''; echo' <ul class="nav">'; //FIND NESTED TITLES / LINKS $headText = Text::find_by_child($Hid); foreach ($headText as $headTexts){ $Cid = $headTexts->id; $Cname = $headTexts->name; $Cparent = $headTexts->parent; echo ***THIS IS WHERE IS WANT THE CODE*** ? '<li><a href="">'.Cname.'</a></li>' : '<li><a href="" class="subTitle">'.Cname.'</a>'; echo' <ul class="subLevel" style="margin-left: 15px">'; //FIND SUBLINK $sub = Text::find_by_child($Cid); foreach ($subs $subs){ $name = $subs->name; echo'<li><a href="">'.$name.'</a></li>'; } echo' </ul> </li>'; } echo'</ul>'; } echo'</div>'; ?>
  22. hello i have another question. how would i put php in to it? say i have this $headText = PageContent::find_text($headText); foreach ($headText as $headTexts){ $header = $headTexts->title; echo $navPnt == 0 ? '<h3 class="menuheader expandable">'.$header.'</h3>' : ''; } now, what would i do if i want to move this line inside it this is what i tried but i get an error $headText = PageContent::find_text($headText); foreach ($headText as $headTexts){ echo $navPnt == 0 ? $header = $headTexts->title; '<h3 class="menuheader expandable">'.$header.'</h3>' : ''; }
  23. how do i find out if a parent has any children? for example id - name - parent_id 1 - title1 - 0 (parent) 2 - title2 - 0 (parent) 3 - link1 - 1 (child) 4 - link2 - 1 (child) 5 - link3 - 2 (child) 5 - link4 - 2 (child) the above has 2 parent with 2 links each. so.. if an id has no "parent_id" pointing to it must be a child if an id has "parent_id" pointing to it must be a parent i have a list <ul> <li><a href="">'.$link.'</a></li> <li><a href="" class="subTitle">'.$title.'</a> <ul class="subLink"> <li><a href="">'.$link.'</a></li> </ul> </li> </ul> so i want to do something like if id has no "parent_id" pointing to it, it is a $link if id has "parent_id" pointing to it, it is a $title any thoughts thanks
  24. no. that did not seem to work. maybe if i show you what im actually trying to do. im trying to get my navigation from a database but put most of the code in a function so i can use it for different navigation. in my database i have: there could be any number of these. i.e there could be 10 titles. ID - TITLE - PARENT ID 1 - title1 - 0 2 - title2 - 0 3 - link1 - 1 4 - link2 - 2 5 - subtitle1 - 1 6 - subtitle2 - 2 7 - sublink1 - 5 8 - sublink2 - 6 so the structure would be title1 - link1 - subtitle1 - sublink1 title2 - link2 - subtitle2 - sublink2 in my function i have. im using "Passing by Reference" to pass the value to the page where its needed function nav(&$nav_id, &$nav_Pnt, &$nav_txt){ $nav = Nav::find_all(); foreach ($nav as $navs){ $nav_id .= $navs->id; $nav_pnt .= $navs->parent_id; $nav_txt .= $navs->title; } } so on the page i have this <?PHP require_once("includes/initialize.php"); ?> //FIND FUNCTION <?PHP echo' <div class="arrowlistmenu">'; //GET FUNCTION nav($nav_id, $nav_Pnt, $nav_txt); // I NEED TO GET ALL FROM DB HERE. // AT THE MOMENT I ONLY GET 1 1TITLE RETURNED //IF PARENT ID IS "0" IT MUST BE A TITLE if($nav_Pnt == "0"){ echo' <h3 class="menuheader expandable">TITLE='.$nav_txt.'</h3>'; } echo' <ul cl/ass="categoryitems">'; //LINKS //IF PARENT ID == ID OF THE ONE ABOVE IT MUST BE ITS CHILD if($nav_pnt == $nav_id){ echo' <li><a href="">LINK='.$nav_txt.'</a></li>'; } //SUBTITLE if($nav_pnt == $nav_id){ echo' <li><a href="" class="subexpandable">SUBTITLE=</a>'; } if($nav_pnt == $nav_id){ echo' <ul class="subcategoryitems" style="margin-left: 15px">'; if($nav_pnt == $nav_id){ echo' <li><a href="">SUBLINK=</a></li>'; } echo' </ul>'; } echo'</li></ul></div>'; } ?> any thoughts ?
×
×
  • 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.