ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Woes over a CSS menu using PHP to read a query string so it knows where it's at.

October 29, 2007 7:41pm

Subscribe [2]
  • #1 / Oct 29, 2007 7:41pm

    APGWest

    295 posts

    I’m attempting to integrate the wonderful drop-line menu from Stu Nicholls ( found here) but it’s not updating the selected tab as current when clicked on.  In other words the default state of a tab is gray but when it’s the currently selected tab, it changes to blue.  This is supposed to happen thanks to PHP as per Stu’s description:

    ...the page will reload with your selection as the current highlighted choice.
    This is done using php to read the query string and write the ‘current’ and ‘current_sub’ classes into the chosen link and sub-link when the page is reloaded.

    Inside the menu, a top-level link should look something like this (with the string after the ? hard-coded into each link):

    <a href="test.html?current=one&sub=none">

    I believe the problem is that EE links don’t have the .php or .html at the end and are more along the lines of:

    <a href="mysite.com/index.php/sports/football_winner_takes_all">

    so if I were to follow his rules of hard-coding the string into each link, the above would look like:

    <a href="mysite.com/index.php/sports/football_winner_takes_all?current=one&sub=none">

    which doesn’t work (obviously).


    I know this is getting pretty far away from EE but I’m in love with this menu and all I have left is to figure this one bit out!

  • #2 / Oct 30, 2007 8:50am

    Tim Griffiths

    36 posts

    Not sure exactly how you are trying to use this. Do you have an example of your own code? Are you using EE category lists? If so, could you not achieve this using the category tag variables to give each category list item a unique id and then do the context coloring in CSS by grabbing some info from the URL?

    *ADDED* this thread could be useful also http://ellislab.com/forums/viewthread/63763/

  • #3 / Oct 30, 2007 6:31pm

    APGWest

    295 posts

    Hi Tim,

    I’m trying to use it pretty much “out of the box” as Stu shows it.  I’m just planning on changing the links, link names and a few looks but the underlying stuff would remain intact.  Oh and it’s not for constantly changing articles or anything—just links to pages that will never need changed.

    Again, I think the issue comes from the addition of the “?current=one&sub=a” portion that because that is what tells the CSS which class to use.  However, it’s not coming after a .php or .html since EE structures the URLs the way it does.  That’s all assumption on my part mind you. 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases