1

I want to create simple tree menu. But I can only use PHP or HTML. In my case I am not allowed to include any JavaScripts.

1
  • Css is also not allowed? Commented Jan 21, 2011 at 13:38

2 Answers 2

1

Stu Nichols at CSS Play would be a good place to start looking at.

Sign up to request clarification or add additional context in comments.

Comments

0

IMHO, it's bad form. But you could use the GET method with links to pass values to your PHP file then return the appropriate response to the page.

ie.

<?php
    if(!isset($_GET['link'])){
        $_GET['link'] = ""; // if not set, gets dummy value
    }

    $link = $_GET['link'];

    function showPage($link){
        switch($link){
            case "home":
                echo "<a href='page.php?link=homesub1'>Home Sub Menu 1</a><br>";
                echo "<a href='page.php?link=homesub2'>Home Sub Menu 2</a>";
                break;
            case "other":
                echo "<a href='page.php?link=osub1'>Other Page Sub Menu 1</a><br>";
                echo "<a href='page.php?link=osub2'>Other Page Sub Menu 2</a>";
                break;
        }
    }
?>
<a href="page.php?link=home">HOME</a>
<a href="page.php?link=other">Some Page</a>

<br>
<?php
    if($link != ""){
        showPage($link);
    }
?>

Obviously, a lot of thought has to be put in for the design to work. It's a disaster but it gets the job done.

Note: A better approach to this would be to convince whoever is in-charge to let you use JS/jQuery.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.