Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1064079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:52:37+00:00 2026-05-16T18:52:37+00:00

I am just starting PHP (as in today). I want to create a customizable

  • 0

I am just starting PHP (as in today).
I want to create a customizable menu using a jquery script that can have a variable amount of items.

I am getting an error when i run this.
The error is:

Parse error: syntax error, unexpected T_VARIABLE in /home/s0urc3/public_html/files01/menu.php on line 5

Thanks to Chase for his answer

index.php:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<?PHP
$script_url="http://files01.s0urc3.ismywebsite.com/jquery/nagging-menu/nagging-menu.js";
$menu_css="http://files01.s0urc3.ismywebsite.com/jquery/nagging-menu/style.css";
$links = array(
    array("url" => "http://www.something1.com", "label" => "something"),
    array("url" => "http://www.something2.com", "label" => "something2"),
    array("url" => "http://www.something3.com", "label" => "something3"),
);
include("menu.php");
?>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
<title></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href=".css"/>
</head>
<body>
<?=writeMenu($links, $menu_css, $script_url)?>
</body>
</html>

menu.php:

<?
function writeMenu($links, $script_url, $menu_css){
$menu = '<link href=\"$menu_css\" type=\"text/css\">'
    $menu = '<div id="navi">';
    $menu .= '<div id="menu" class="default">';
    $menu .= '<ul>';

    foreach ($links as $item) {
        $menu .= "<li><a href=\"".$item['url']."\">".$item['label']."</a></li>";
    }

    $menu .= "</ul>";
    $menu .= "</div>";
    $menu .= "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js\" charset=\"utf-8\"></script>";
    $menu .= "<script type=\"text/javascript\" src=$script_url charset=\"utf-8\"></script>";

    return $menu;
}
?>

Thanks to Chase for his Re-script

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:52:37+00:00Added an answer on May 16, 2026 at 6:52 pm

    Ok so i looked over the code so generously supplied by chase an solved my own issue. 😀

    here is the code of both menu.php and index.php

    Menu.php:

    <!--
    PHP menu by ellisgeek
    $email = 'ellisgeek@gmail.com';
    $URL = 'http://s0urc3.ismywebsite.com'
    Original code by chase on StackOverflow.com
    -->
    <?
    function writeMenu($links, $css){
    echo  '<link rel="stylesheet" type="text/css" href="$css" media="screen"/>';
    echo  '<div id="navi"><div id="menu" class="fixed"><ul class=""> ';
    
    
    foreach ($links as $item) {
        echo "<li><a href=".$item['url'].">".$item['label']."</a></li>";
    }
    
    echo  "</ul>";
    echo  "</div>";
    echo  "</div>";
    }
    ?>
    

    Index.php:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <head>
    <?
    $css="style.css";
    $links = array(
        array("url" => "http://www.something1.com", "label" => "something"),
        array("url" => "http://www.something2.com", "label" => "something2"),
        array("url" => "http://www.something3.com", "label" => "something3"),
    );
    include("menu.php");
    ?>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
    <title></title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" type="text/css" href=".css"/>
    </head>
    <body>
    <?=writeMenu($links, $menu_css, $script_url)?>
    <p>Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum Lorum</p>
    <!--Add lotsa these-->
    </body>
    </html>
    

    this will write a menu using a ul and a few div’s feel free to copy n paste just don’t remove the credit comment please.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am just starting out developing PHP web applications and have finished setting
I am just starting to look at JQuery; until now everything has been PHP.
Hey guys, I'm just starting out with MySQL and PHP and have a question.
Good day. I have a PHP & MySql background, and I'm just starting with
Just starting out in asp.net. Have just created a login.aspx page in my site
I am just starting out with DI & unit testing and have hit a
I am just starting to learn javascript, so I don't have the skills to
I am just starting php. I am just curious if there is a better
i`m just starting in php, and I was wondering how to make a sign
Just starting to explore the 'wonders' of regex. Being someone who learns from trial

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.