December 02, 2008, 01:15:14 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: WELCOME! As you can see we have changed forum systems, for good I hope.
Home
Forum
Help
Search
Calendar
Login
Register
Shop
Gallery
ThePlatoon.com
>
General Discussion
>
Hardware & software
>
HTML or PHP?
Pages: [
1
]
Go Down
« previous
next »
Print
Author
Topic: HTML or PHP? (Read 575 times)
0 Members and 1 Guest are viewing this topic.
Lazerblade
Sr. Member
Rep: 1
Offline
Posts: 640
1868.50 credits
View Inventory
Send Money to Lazerblade
HTML or PHP?
«
on:
April 04, 2008, 04:25:30 PM »
OK, this one may be difficult, but hopefully someone knows of a trick.
I have a multi-page site split up into headers and footers. I really want to maintain the separation as is in case more pages get added later. Of course I'll have to modify the header if I do add pages later, but I'd rather modify the code for the header and add a single page than modify all of the pages.
Currently, I have a header.php and header_menu.php. I also have the individual pages (index.php, menu.php, main_courses.php, beverages.php, etc...), and a footer.php page.
Is there a way I can have an image in header_menu.php swap from the stock image to a highlighted version (beverages.png swaps to beverages_lit.png) only if the page shown is beverages.php?
What I mean is, is there a relatively easy way to implement some code in the header_menu.php page that can check to see which page it is on and act accordingly? I understand php to an extent, but consider myself to be a beginner for the most part. I also understand HTML and XML to an extent but again- I'm no expert.
Code: "<? include 'header_menu.php'; ?>
<!-- Content here for each page -->
<? include 'footer.php'; ?>"
I can copy/paste the code as needed if it will help.
Logged
Shrap. You've left us, but not without impacting our lives.
farmboy
4:31 mile
Sr. Member
Rep: 9
Offline
Posts: 907
4007.00 credits
View Inventory
Send Money to farmboy
Re: HTML or PHP?
«
Reply #1 on:
April 04, 2008, 06:25:36 PM »
I think I can come up with some javascript code that should do what you want within the html, but I'll have to dig up some old source code for the syntax. It should be really short, like 5 lines.
Logged
Zazoo
Administrator
Hero Member
Rep: 13
Offline
Posts: 1332
1829.50 credits
View Inventory
Send Money to Zazoo
Re: HTML or PHP?
«
Reply #2 on:
April 04, 2008, 09:54:55 PM »
If you're using the include command to add the the menu to each content page then you can just have php at the beginning of the content page that sets an ID variable (e.g. <?PHP $currentpage="BEVERAGES">, there are even commands in PHP that will return the name of the current page automatically -- like $_SERVER[’SCRIPT_NAME’]). Then have code in the header_menu.php file that checks the value of $currentpage and sets the appropriate highlight image.
~Mike
Logged
http://www.mcschell.com/gallery
Lazerblade
Sr. Member
Rep: 1
Offline
Posts: 640
1868.50 credits
View Inventory
Send Money to Lazerblade
Re: HTML or PHP?
«
Reply #3 on:
April 08, 2008, 11:20:12 PM »
Thanks Mike! That was so obvious and yet I couldn't even see it. Simple to implement too. Sweet!
Of course now you know I'll be coming to you for future answers.
Logged
Shrap. You've left us, but not without impacting our lives.
Pages: [
1
]
Go Up
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
News and Announcements
-----------------------------
=> Gaming News
=> General News
-----------------------------
Gaming Discussion
-----------------------------
=> General Gaming
=> Ghost Recon: Advanced Warfighter
=> Rainbow Six Vegas
-----------------------------
Creative Gamers
-----------------------------
=> Modding General
=> Movie makers forum
-----------------------------
General Discussion
-----------------------------
=> Off topic chit-chat
=> Hardware & software
=> Film and media
=> Music and musicians
=> Politics and religion
=> Site Feedback/Suggestions