SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php mysql menu class

    Hi,
    I'm stuck with php menu class from sitepoint php anthology vol. 1 chapter 9 example.

    $baseUrl='/products/books/biography/';
    output is following
    Notice: Menu Location not found in /home/kxa/public_html/test/menu/Menu.php on line 86

    On sitepoint forums I've found question exactly with same problem as mine but I didn't find the answer.
    If know the solution please post it.

    My other question is which php class do you recommend for manipulating menus from mysql data ?

    regards,

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.sitepoint.com/forums/show...00&postcount=4

    Originally Posted by soteros
    Did you solve this one?

    I'm having the same problem but can't find any solutions posted in the forums!
    After THINKING this one over I realised that you get the "Menu Location not found" error unless you modify the contents of the menu table supplied with the code archive!

    Added the locations of my /PHPAnthologyCode/WebPAgeElements/12.php to the menu table and the script worked perfectly on my Windows test box but still failed on my Redhat EL3 production server with Plesk 7.0.2! This might be a problem with str_replace() on my Plesk server's version of PHP (4.3.2)?

    Tried using pathinfo() to break down the URL fragments: -

    <?php
    $url = $_SERVER['PHP_SELF'];
    echo "Path = " . $url . "<br />";
    echo "Path fragments: -<br />";
    $fragments = pathinfo($_SERVER['PHP_SELF']);
    echo "Directory = ". $fragments['dirname']. "/<br />";
    echo "File Name = " . $fragments['basename']. " <br />";
    echo "File Type = ". $fragments['extension']. " <br />";
    ?>

    Modified 12.php by replacing

    // Set the base location for this page relative to web root - MODIFY THIS!!!
    $baseUrl='/PHPAnthologyCode/WebPageElements/12.php';

    // Fetch the location framement to match against menu table
    $location = str_replace ($baseUrl,'',$_SERVER['PHP_SELF']);

    with

    // Fetch the location fragment to match against menu table
    $path = pathinfo("$_SERVER[PHP_SELF]");
    $dirname = $path['dirname'];
    $location = $dirname. "/";

    Modified script works OK on my Windows test box and the RH EL3 Plesk server.
    Have you tried this?

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I tried that but doesnt work.
    Now I'm bulding my own class for drop down menus so when it will be finish I will post it.

    thanks for info.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •