Jump to content

Fotographer96

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by Fotographer96

  1. @mjdamato: Do you know something?? You are the best!! Well, sorry for ignoring your advices, next time I'll try to do it as you say
  2. Database Structure: Database Entries: HTML Output: <ul> </ul> </li> <li class="mainnav"><a rel="nofollow" href="view.php?id=1">STre</a><ul> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=1">Site 1</a></li> <li class="mainnav"><a rel="nofollow" href="view.php?id=4">Well</a><ul> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=3">Design</a></li> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=2">tySpa</a></li> </ul> </li> </ul> <ul> <li class="mainnav"><a href="index.php">Starline</a></li> <li class="mainnav"><a rel='nofollow' href='view.php?id=1'>STre</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=1'>Site 1</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=4'>Well</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=2'>tySpa</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=4'>Well</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=3'>Design</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=2'>Group</a></li> <li class="mainnav"><a rel='nofollow' href='view.php?id=3'>Spa</a></li> </ul> Hope it helps..
  3. Hey, A feew posts befor you told me to change a line, that one I missed and did a mistake.. Yea I do. It was a mistake! I never thought I do better! I'm a beginner how could I? Ok. The effect doesn't change.. I have to go now, tomorrow we will continue talking.
  4. here it is: <?php $query = "SELECT pp.ID, pp.Name, p.pageName, p.pageID FROM parent_pages AS pp JOIN pages AS p ON p.parentID = pp.ID ORDER BY pp.Name"; $result = mysql_query($query) or die(mysql_query()); //Open the parent UL $menuHTML = "<ul>\n"; $currentParentID = false; while ($row = mysql_fetch_assoc($result)) { if($currentParentID != $row['ID']) { //This is a new parent page if($currentParentID==false) { //If not first parent, close last submenu UL and parent LI $menuHTML .= "</ul>\n"; $menuHTML .= "</li>\n"; } $currentParentID = $row['ID']; //Open new parent LI, create link and open submenu UL $menuHTML .= "<li class=\"mainnav\">"; $menuHTML .= "<a rel=\"nofollow\" href=\"view.php?id={$row['ID']}\">{$row['Name']}</a>"; $menuHTML .= "<ul>\n"; } //Create submenu LI $menuHTML .= "<li class=\"subnav\">"; $menuHTML .= "<a rel=\"nofollow\" class=\"sublink_nav\" href=\"viewpage.php?pageid={$row['pageID']}\">{$row['pageName']}</a>"; $menuHTML .= "</li>\n"; } //Close last child UL, parent LI and parent UL $menuHTML .= "</ul>\n"; $menuHTML .= "</li>\n"; $menuHTML .= "</ul>\n"; echo $menuHTML; ?>
  5. If you only have two levels then, no, you don't want recursion. Also, what you are posting is completely impossible based upon the code I provided. PLease post the code you have. <ul> </ul> </li> <li class="mainnav"><a rel="nofollow" href="view.php?id=1">STre</a><ul> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=1">Seite 1</a></li> <li class="mainnav"><a rel="nofollow" href="view.php?id=4">Wellness</a><ul> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=3">Design</a></li> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=2">SPA</a></li> </ul> </li> </ul> <ul> <li class="mainnav"><a href="index.php">STre</a></li> <li class="mainnav"><a rel='nofollow' href='view.php?id=1'>Star</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=1'>Site 1</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=4'>Well</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=2'>SPA</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=4'>Well</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=3'>Design</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=2'>Group</a></li> <li class="mainnav"><a rel='nofollow' href='view.php?id=3'>tySpa</a></li> </ul> </div> I thought I would make it easier to read for you.. but here it is.
  6. result: <ul> </ul> </li> <li class="mainnav"><a rel="nofollow" href="view.php?id=1">parent_page</a><ul> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=1">page</a></li> <li class="mainnav"><a rel="nofollow" href="view.php?id=4">parent_page</a><ul> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=3">page</a></li> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=2">page</a></li> </ul> </li> </ul> <ul> <li class="mainnav"><a rel='nofollow' href='view.php?id=1'>parent_page</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=1'>page</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=4'>parent_page</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=2'>page</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=4'>parent_page</a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=3'>page</a></li> </ul> </li> <li class="mainnav"><a rel='nofollow' href='view.php?id=2'>parent_page</a></li> <li class="mainnav"><a rel='nofollow' href='view.php?id=3'>parent_page</a></li> </ul> May it would help, if it is coded with recursion? I think so.. because it's hierarchical
  7. ...is invalid HTML! You need to remove the closing </li> after the parent name. You already have the correct closing LI at the end of the list of submenus. The code I provided should work as you ask. Sorry, typing mistake Yeah I know.. and there is a problem with that code too.. mjdamato's code gives me that result: <ul> </ul> </li> <li class="mainnav"><a rel="nofollow" href="view.php?id=1">parent_page</a><ul> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=1">parent_page</a></li> <li class="mainnav"><a rel="nofollow" href="view.php?id=4">parent_page</a><ul> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=3">parent_page</a></li> <li class="subnav"><a rel="nofollow" class="sublink_nav" href="viewpage.php?pageid=2">parent_page</a></li> </ul> </li> </ul>
  8. Sorry, and thanks for the code! U r the best!!!!
  9. We're going to need more detail than that. Ok. But what for detail? I mean I gave you all what I have and want. Tell me just what you need and I will give you .
  10. Doesn't work properly.. if I create more than one page for the parent_page, than it creates a new menu(<ul>-tag).. that's why I asked you here.. I need to handle it with a recursive function.. You have to understand me.. I don't know how it actually works(the recursion), before I was posting here I was looking out for tutorials.. I didn't find the key.. so I hope, that you create that function and I can see how it works(on my problem).. that's all!
  11. Yeah, I did.. but that is real mess.. have a look for yourself: <ul> <?php $result = mysql_query("SELECT * FROM pages INNER JOIN parent_pages ON pages.parentID=parent_pages.ID WHERE pages.parentID=parent_pages.ID"); while ($row = mysql_fetch_assoc($result)):?> <li class="mainnav"><a rel='nofollow' href='view.php?id=<?php print $row['ID'];?>'><?php print $row['Name'];?></a> <ul> <li class="subnav"><a rel='nofollow' class="sublink_nav" href='viewpage.php?pageid=<?php echo $row['pageID'];?>'><?php print $row['pageName'];?></a></li> </ul> </li> <?php endwhile;?> <?php $result = mysql_query("SELECT * FROM parent_pages WHERE pageID='0'"); while ($row = mysql_fetch_assoc($result)):?> <li class="mainnav"><a rel='nofollow' href='view.php?id=<?php print $row['ID'];?>'><?php print $row['Name'];?></a></li> <?php endwhile;?> </ul> I just need a small snippet.. no database connection or something else.. just the function
  12. Hey guys, I've got a problem. I need a function, that gives me a menue like that: parent_page1 page1 page2 page3 parent_page2 page1 page2 page3 So.. here is my database structure: All what I need, is a function, that gives me a menu like that on top. Do you need some more information? Let me know..
×
×
  • 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.