Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17

Thread: LavaLamp Help

  1. #1
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    http://vmt.comxa.com/
    No matter which page I am on, the lavalamp highlight jumps to 'home' on the navigation. Anyone know how to make it so it highlights the page that I'm on?
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    put class="current" on the li relating to your current page.

  4. #3
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    Quote Originally Posted by bestbuyz, post: 208768
    I tried to respond to your request earlier but I guess you never got it. Anyways, here's the answer you're looking for.

    You need to implement a php include for your header. Or wherever your menu is located within. After that, for each page you want to change, rename the php include file and alter the class="current" section. I'll give you an example.

    This first set of code is the include_header.php file for my index.php page (or wherever I want my HOME background to show.):
    I have removed a lot of the code that is unnecessary.

    <td align="center" valign="middle"><table width="250" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><ul class="lavaLampWithImage" id="1">
    <li class="current"><a href="http://www.downloadcloud.net">Home</a></li>

    <li><a href="downloads.php" target="_self">Downloads</a></li>

    <li><a href="prices.php">Prices</a></li>

    <li><a href="why-us.php">Why Us?</a></li>

    <li><a href="contact.php">Contact</a></li>

    </ul>
    ////////////////////////////////////////////////////////////////

    Here is my second example (With a background block for a different page):

    I have renamed the file: include_header_downloads.php

    <td align="center" valign="middle"><table width="250" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><ul class="lavaLampWithImage" id="1">

    <li><a href="http://www.downloadcloud.net">Home</a></li>

    <li class="current"><a href="downloads.php" target="_self">Downloads</a></li>

    <li><a href="prices.php">Prices</a></li>

    <li><a href="why-us.php">Why Us?</a></li>

    <li><a href="contact.php">Contact</a></li>

    </ul>

    The only thing you must do then is add the corresponding php include file to each page you want to distinguish.
    Thanks!! I'll give it a shot.
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  5. #4
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    What's the 'target="_self"' attribute?
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  6. #5
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    And.. What css did you use for the "current" class?
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  7. #6
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    Quote Originally Posted by bestbuyz, post: 208882
    You can disregard that. It was a mistake and does not affect the outcome of the lavalamp function.
    Ah ok.
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  8. #7
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    .current isn't on there though...
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  9. #8
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    Quote Originally Posted by bestbuyz, post: 208889
    Doesn't have to be.
    Then what is it doing in the HTML?
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  10. #9
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    I already knew that, I just didn't know how.
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  11. #10
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    That's a roundabout way of doing a header include... instead, you should just use PHP to determine which page you're on and apply the "current" class appropriately, e.g.:

    PHP Code:
    <?php
    $pages 
    = array(
        
    "/" => "Home",
        
    "/downloads.php" => "Downloads",
        
    "/prices.php" => "Prices",
        
    "/why-us.php" => "Why Us?",
        
    "/contact.php" => "Contact");

    print(
    '<ul class="lavaLampWithImage" id="1">');
    foreach (
    $pages as $url => $title) {
        
    $class $_SERVER['REQUEST_URI'] == $url ' class="current"' '';
        print(
    '<li><a href="'.$url.'"'.$class.'>'.$title.'</a></li>');
    }
    print(
    '</ul>');
    ?>
    And that will work for as many pages as you want it to... just add pages to your array and your menu will dynamically grow with your site.


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:52 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com