
PHP navigational menu with 'Current Page' class based on filename and query string
- or -
Post a project like this2968
£20(approx. $27)
- Posted:
- Proposals: 1
- Remote
- #1782691
- Awarded
Description
Experience Level: Intermediate
General information for the website: Simple ecommerce store
Description of requirements/features: I need a PHP-driven navigational menu which will automatically assign Class="currentPage" to the menu item corresponding to the current page. The HTML for the navigational menu can be a simple unordered list.
I'm comfortable with CSS/HTML but need help with the PHP.
The list of pages is:
Menu Item URL
-------------------------------------------------------------------------------
Page 1 http://mydomain/index.php
Page 2 http://mydomain/about.php
Page 3 http://mydomain/products.php
Page 4 http://mydomain/products.php?scri=30
Page 5 http://mydomain/products.php?&scri=31
Page 6 http://mydomain/products.php?&scri=32
Page 7 http://mydomain/cart.php
Some of the menu items can be matched to the page simply by matching the php file name, e.g. index.php would match 'Page 1'.
Other menu items need to be matched based on the contents of the Query String. For example:
products.php?scri=30 matches 'Page 4'
products.php?scri=31 matches 'Page 5'.
Further, the Query String parameter 'scri' potentially contains MULTIPLE values in ANY order, e.g.
products.php?scri=30,9,1
products.php?scri=9,4,1,30
In this example, therefore, the PHP code should look for the value '30' for parameter 'scri' anywhere in the Query String and match that to 'Page 4'.
Extra notes:
Description of requirements/features: I need a PHP-driven navigational menu which will automatically assign Class="currentPage" to the menu item corresponding to the current page. The HTML for the navigational menu can be a simple unordered list.
I'm comfortable with CSS/HTML but need help with the PHP.
The list of pages is:
Menu Item URL
-------------------------------------------------------------------------------
Page 1 http://mydomain/index.php
Page 2 http://mydomain/about.php
Page 3 http://mydomain/products.php
Page 4 http://mydomain/products.php?scri=30
Page 5 http://mydomain/products.php?&scri=31
Page 6 http://mydomain/products.php?&scri=32
Page 7 http://mydomain/cart.php
Some of the menu items can be matched to the page simply by matching the php file name, e.g. index.php would match 'Page 1'.
Other menu items need to be matched based on the contents of the Query String. For example:
products.php?scri=30 matches 'Page 4'
products.php?scri=31 matches 'Page 5'.
Further, the Query String parameter 'scri' potentially contains MULTIPLE values in ANY order, e.g.
products.php?scri=30,9,1
products.php?scri=9,4,1,30
In this example, therefore, the PHP code should look for the value '30' for parameter 'scri' anywhere in the Query String and match that to 'Page 4'.
Extra notes:
André P.
100% (14)Projects Completed
15
Freelancers worked with
12
Projects awarded
35%
Last project
28 Oct 2022
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies