A Digital Age Deserves A Digital Leader

Change menu from HTML to PHP [Solved]

Change menu from HTML to PHP [Solved]

Postby bigt0242000 » Tue Feb 12, 2008 10:09 pm

OK below is the HTML from my church's front page with everything except the menu part cut out. How would you change at least the "TreeMenuNav" part to PHP so I don't have to update it the way it is now on 30+ pages? Thanks in advance.

Code: Select all
<head>
<meta>
<title></title>
<script type="text/javascript" src="./js/menu.js"></script>
</head>
</html>
<body>
   <div id="leftbar" class="lsidebar">
      <div id="NavDiv">
          <div id="TreeMenuCtrl">
             <p><a href="#">Expand All</a> | <a href="#">Collapse All</a></p>
          </div>
          <div id="TreeMenuNav">
            <div><a href="./index.html" target="_top" tabindex="1">Home</a></div>
            <div><a href="#" tabindex="2">What's the Pointe?</a>
              <div><a href="./about_us.html" tabindex="3">About Us</a></div>
              <div><a href="./beliefs.html" tabindex="4">Our Core Beliefs</a></div>
              <div><a href="./values.html" tabindex="5">Our Core Values</a></div>
              <div><a href="#" tabindex="6">Our History</a>
                <div><a href="./history.html" tabindex="7">History</a></div>
                <div><a href="./former_pastors.html" tabindex="8">Former Pastors</a></div>
              </div>
              <div><a href="./mission.html" tabindex="9">Our Mission Statement</a></div>
              <div><a href="#" tabindex="10">Our Staff</a>
                <!-- <div><a href="#" tabindex="11">???</a></div> -->
                <div><a href="./senior_pastor.html" tabindex="12">Senior Pastor</a></div>
                <div><a href="./associate_pastor.html" tabindex="13">Associate Pastor</a></div>
                <div><a href="./youth_minister.html" tabindex="14">Youth Minister</a></div>
                <!-- <div><a href="./childrens_minister.html" tabindex="15">Children's Minister</a></div> -->
              </div>
            </div>
            <div><a href="#" tabindex="16">Programs</a>
                 <div><a href="./nursery_preschool.html" tabindex="17">Nursery/Preschool</a></div>
              <div><a href="#" tabindex="18">Children</a>
                 <div><a href="./children.html" tabindex="19">What's Going On</a></div>
                 <div><a href="./childrens_calendar.html" tabindex="20">Calendar</a></div>
                 <div><a href="./childrens_forms.html" tabindex="21">Forms</a></div>
              </div>
              <div><a href="#" tabindex="22">Student</a>
                 <div><a href="./student.html" tabindex="23">From the Youth Minister</a></div>
                 <div><a href="./youth_calendar.html" tabindex="24">Calendar</a></div>
                 <div><a href="#" tabindex="25">Bryan's Blog</a></div>
                 <div><a href="./youth_forms.html" tabindex="26">Forms</a></div>
              </div>
            </div>
            <div><a href="./calendar.html" tabindex="27">Calendar</a></div>
            <div><a href="./location.html" tabindex="28">Location</a></div>
            <div><a href="./membership.html" tabindex="29">Membership</a></div>
            <div><a href="./contact_us.html" tabindex="30">Contact Us</a></div>
            <div><a href="./resources.html" tabindex="31">Resources</a></div>
          </div>
      </div>      
   </div>
</body>
</html>
Last edited by bigt0242000 on Sat Feb 16, 2008 5:55 am, edited 2 times in total.
Image
Image
PRO Level 2
Posts: 19
Joined: Thu Jun 17, 2004 12:55 am
Location: Rome, GA

Postby jbullard » Tue Feb 12, 2008 11:48 pm

Sure. Here is what you need to do.

1. Create a file called menu.php and put what you want in that file.

You don't have to use echoing or anything like that. You also don't need to put the PHP tags in this file. Just the extension will do.

2. In your files put the following
Code: Select all
<?php

@include('menu.php');

?>
VP - Software
User avatar
Posts: 3653
Joined: Sun Jun 06, 2004 10:17 pm
Location: Utah
Real Name: Jason Bullard

Postby bigt0242000 » Wed Feb 13, 2008 6:00 pm

I tried that and it didn't work. Anything else I could try?
Image
Image
PRO Level 2
Posts: 19
Joined: Thu Jun 17, 2004 12:55 am
Location: Rome, GA

Postby imnuts » Thu Feb 14, 2008 1:09 pm

make sure that when you put that into the file where the menu was, you change the extension to .php and that both files reside in the same directory.
Image
PRO SUPREME
User avatar
Posts: 7457
Joined: Wed Mar 24, 2004 5:19 am
Location: Boothwyn, Pennsylvania
Real Name: Mark

Postby bigt0242000 » Thu Feb 14, 2008 11:53 pm

Both files where in the same directory. The menu file had the .php extension.

Would that javascript file have anything to do with me having trouble?

I'm still new to php, so would I have to make any other changes to the html file other than adding the code above to it.
Image
Image
PRO Level 2
Posts: 19
Joined: Thu Jun 17, 2004 12:55 am
Location: Rome, GA

Postby imnuts » Fri Feb 15, 2008 12:02 am

whatever file you put the code into needs to be a .php file as well. Otherwise, the server won't process any php functions in the file. So if the homepage was originally index.html before you added that code, you'll want it to be index.php with that code in it so the server then processes the statement and includes the menu.php file.
Image
PRO SUPREME
User avatar
Posts: 7457
Joined: Wed Mar 24, 2004 5:19 am
Location: Boothwyn, Pennsylvania
Real Name: Mark

Postby bigt0242000 » Fri Feb 15, 2008 12:41 am

Thanks for the quick reply. I'll give that a try and see what happens.
Image
Image
PRO Level 2
Posts: 19
Joined: Thu Jun 17, 2004 12:55 am
Location: Rome, GA

Postby bigt0242000 » Sat Feb 16, 2008 5:54 am

Well that was my problem, I didn't change the file ext from html to php. Thanks for the help guys. :notworthy
Image
Image
PRO Level 2
Posts: 19
Joined: Thu Jun 17, 2004 12:55 am
Location: Rome, GA

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: Google [Bot] and 1 guest