30 users online (1 members and 29 guests)  


Page 2 of 2 First 1 2
  Results 16 to 26 of 26

Related

  1. Side by side html tables    Forum: HTML Forum
    Replies: 7
  2. Replies: 2
  3. PHP / MYSQL Side Menu    Forum: PHP Forum
    Replies: 6
  4. Replies: 4
  5. Replies: 4
  1. #16
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: side menu item only shows when DB has item in field

    OK
    In the flyout, $url15 = Hello World, so in theory if we change the php to
    PHP Code:
    <?php 
    if ($url15 != "Hello World") { echo "<a class='item2' href='$url15_url'>$url15</a>"; } 
    ?>
    it should work.

    However $url15_url = software/files/manuals/Celerity.pdf, which is the same as the Manuals & Specifications link so either $url15 refers to the Manuals & Specs link, or $url15 is being incorrectly populated by the database query.

    We're getting there, I think

  2. #17
    bufhal's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    32

    Re: side menu item only shows when DB has item in field

    I just copied the link for Manuals and Specs into the DB to test. This is working when the DB is populated. It is when I empty the two DB fields, url15 and url15_url, the "Special" menu link needs to disappear.
    It is close, but that is where I am stuck.
    Thank you for sticking with me on this...

  3. #18
    bufhal's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    32

    Re: side menu item only shows when DB has item in field

    Hello;
    I changed "blank" to 'Hello World"
    http://www.attotech.com/gary_side_test.html

  4. #19
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: side menu item only shows when DB has item in field

    I think I'm there - I was putting the condition at the flyout submenu level, not the menu level ...
    Try the following
    PHP Code:
    <a class="item3 arrow" href="javascript:void(0)">Request Information<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a> 
    <div style="border: 2px; #FFFFFF" class="section"> 
    <a class="item2" href="/oem.html">Request Sales Support</a> 
    <a class="item2" href="/techsupt.html">Request Technical Support</a> 
    </div> 
    <a class="item3 arrow" href="javascript:void(0)">Solutions<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a> 
    <div style="border: 2px; #FFFFFF" class="section"> 
    <a class="item2" href="/oemsolutions.html">OEM</a> 
    <a class="item2" href="/digitalcc.html">Digital Content Creation</a> 
    <a class="item2" href="/business.html">Backup</a> 
    </div> 

    <?php 
    if ($url15 != "") {
    echo 
    "<a class=\"item3 arrow\" href=\"javascript:void(0)\">Special";
    echo 
    "<img src=\"/images/arrow3.gif\" width=\"10\" height=\"12\" alt=\"\" /></a>\n"
    echo 
    "<div style=\"border: 2px; #FFFFFF\" class=\"section\">\n"
    echo 
    "<a class=\"item2\" href=\"$url15_url\">$url15</a>\n</div>\n";
    }
    ?> 
    </td> 
    </tr> 
    </table><!-- #EndLibraryItem -->
    I've changed the final "Special" menu item to be purely generated by the PHP - for no other reason than it prevents about 4 <?php ... ?> tags wrapping single lines of code!
    The code tests for the $url15 variable to not be an empty string, so it there is anything in the value it will display the link, if not it shouldn't.
    I can never remember whether NULL evaluates to "" or not, so you'll have to find that out
    I've also used \" instead of ' to match the rest of your HTML.
    I really hope this one gets it

  5. #20
    bufhal's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    32

    Re: side menu item only shows when DB has item in field

    I gave it a quick shot and it seems to work!!!
    I will give it a better whirl in the am.
    Thank you very, very much sir. I learned a heck of a lot as well!

  6. #21
    bufhal's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    32

    Re: side menu item only shows when DB has item in field

    Hello Deadmeat;
    Thanks again for the help with the side menu. There is one more request from the "powers to be" that I have been tinkering with a bit. I want to make the display word Special a database item so it can be changed on a page to page basis. I tried a couple of things with echoing a new field (url13) from the DB and received parse errors. I will keep trying-you have helped me tremendiously and know you are probably busy, but would appreciate any suggestion.
    Thank you
    <?php
    if ($url15 != "") {
    echo "<a class=\"item3 arrow\" href=\"javascript:void(0)\">Special";
    echo "<img src=\"/images/arrow3.gif\" width=\"10\" height=\"12\" alt=\"\" /></a>\n";
    echo "<div style=\"border: 2px; #FFFFFF\" class=\"section\">\n";
    echo "<a class=\"item2\" href=\"$url15_url\">$url15</a>\n</div>\n";
    }
    ?>

  7. #22
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: side menu item only shows when DB has item in field

    It should be as simple as:
    PHP Code:
    <?php 
    if ($url15 != "") { 
    echo 
    "<a class=\"item3 arrow\" href=\"javascript:void(0)\">$url13"
    echo 
    "<img src=\"/images/arrow3.gif\" width=\"10\" height=\"12\" alt=\"\" /></a>\n"
    echo 
    "<div style=\"border: 2px; #FFFFFF\" class=\"section\">\n"
    echo 
    "<a class=\"item2\" href=\"$url15_url\">$url15</a>\n</div>\n"

    ?>
    although I might be inclined to use the variable $url15_text simply for consistency - but it won't affect the code in any way!

  8. #23
    bufhal's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    32

    Re: side menu item only shows when DB has item in field

    Hi Deadmeat;
    thanks. I tried this:
    <?php
    if ($url15 != "") {
    echo "<a class=\"item3 arrow\" href=\"javascript:void(0)\">$url13";
    echo "<img src=\"/images/arrow3.gif\" width=\"10\" height=\"12\" alt=\"\" /></a>\n";
    echo "<div style=\"border: 2px; #FFFFFF\" class=\"section\">\n";
    echo "<a class=\"item2\" href=\"$url15_url\">$url15</a>\n</div>\n";
    }
    ?>
    and cannot get the link to display in the menu:
    http://www.attotech.com/new_side_menu_test.html
    I am still trying to get it working. Thanks again for your help.

  9. #24
    bufhal's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    32

    Re: side menu item only shows when DB has item in field

    I have "Testing.." in url13 field of the DB.
    url13 is the only "13" field. trying to figure out why it will not echo...

  10. #25
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: side menu item only shows when DB has item in field

    That field doesn't echo because you're not capturing it. Typically, a variable will be assigned a value through a database read, or as it is passed through a query string in the URL. Even then, you still have to assign a value to it in your script. For example:

    Code:
    $url13 = $_POST['url13'];
    When I'm trying to pinpoint a problem like this, I'll go back as far toward the beginning of my code and put echo statements in it to see what value that variable has when I think a value should have been assigned. Then I keep moving that echo statement around until I've narrowed the problem to the offending code.

    Try that, and if you still don't get anywhere with it, post your complete script so we can have a look at it for you.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  11. #26
    bufhal's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    32

    Re: side menu item only shows when DB has item in field

    Hi, Thanks for the reply;
    The menu as it stands now will show another link when there is an item in the MySQL database. That is url15 and the cooresponding url15_url.
    I am trying to keep that function and get that link to show the contents of url13 from the database.
    Here is the page code with sub routines..
    <?php
    include "subs.php";
    include "DB_subs.php";
    include "menupasswd.inc";
    $error = "";
    //$sku = $_GET['sku'];

    $status = DB_Open($db,$host, $user, $DBpasswd, $conn);
    if ($status) {
    $error = $error . $status;
    echo "error $error";
    exit;
    }

    # get the user info - full record here (avoid doing another query)
    $search = array ("sku" =>"$sku",
    "techsheet" => "",
    "tech_url" => "",
    "brochure" => "",
    "broch_url" => "",
    "soft" => "",
    "soft_url" => "",
    "info" => "",
    "info_url" => "",
    "manual" => "",
    "manual_url" => "",
    "cert" => "",
    "cert_url" => "",
    "url13" => "",
    "url15_url" => "", "url15" => "");

    $table = "product";
    $order_by = "";
    $status = DB_Get($conn, $table, $search, $results,$order_by);
    if ($status) {
    $error = $error . $status;
    echo "error $error";

    } else {
    $numresults = count($results);
    if ($numresults ==0 ) {
    $error = "Product $sku not found";
    } elseif ($numresults > 1) {
    $error = "There was an unexpected database error 1";
    }
    }
    if (! $error ) {
    $temp = $results[0];
    $sku = $temp[sku];
    $techsheet = $temp[techsheet];
    $tech_url = $temp[tech_url];
    $brochure = $temp[brochure];
    $broch_url = $temp[broch_url];
    $soft = $temp[soft];
    $soft_url = $temp[soft_url];
    $info = $temp[info];
    $info_url = $temp[info_url];
    $manual = $temp[manual];
    $manual_url = $temp[manual_url];
    $cert = $temp[cert];
    $cert_url = $temp[cert_url];
    $url13= $temp[url13];
    $url15_url = $temp[url15_url];
    $url15 = $temp[url15];
    }
    $status = DB_Close($conn);


    ?>
    </head>
    <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
    <script type="text/javascript" src="/ie5.js"></script>
    <script type="text/javascript" src="/DropDownMenuX.js"></script>
    <table border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" width=1006>
    <tr>
    <td width="205"><p><!-- #BeginLibraryItem "/Library/leftlogo.lbi" --><a href="/index.html"><img
    src="/images/leftlogo.gif" alt="" border="0" valign="top" /></a><!-- #EndLibraryItem --><br />
    <img src="/images/spacer.gif" alt="" width="1" valign=top height="1" align=left /><img src="/images/spacer.gif" alt="" width="8" valign=top height="612" align=left /></p>








    <!-- #BeginLibraryItem "/Library/sidemenutable.lbi" -->

    <table cellspacing="0" cellpadding="0" id="menu2" class="ddmx">
    <tr>
    <td>
    <td bordercolor="#000000">
    <a class="item3 arrow" href="javascript:void(0)">Product Information<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>

    <div style="border: 2px; #FFFFFF" class="section">

    <a class="item2" href="<?php echo $tech_url; ?>"> Tech Sheet - <?php echo $techsheet; ?> </a>
    <a class="item2" href="<?php echo $broch_url; ?>"> Product Brochure - <?php echo $brochure; ?> </a>
    <a class="item2" href="/howtobuy.html">How to Buy</a>

    </div>

    <a class="item3 arrow" href="javascript:void(0)">Drivers & Downloads<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
    <div style="border: 2px; #FFFFFF" class="section">
    <a class="item2" href="<?php echo $soft_url; ?>">Software - <?php echo $soft; ?></a>

    <a class="item2" href="/whitepapertech.html">Technical Information</a>
    </div>

    <a class="item3 arrow" href="javascript:void(0)">Manuals<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
    <div style="border: 2px; #FFFFFF" class="section">
    <a class="item2" href="<?php echo $manual_url; ?>"> Manual - <?php echo $manual; ?> </a>

    </div>
    <a class="item3 arrow" href="">Certifications<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>

    <div style="border: 2px; #FFFFFF" class="section">
    <a class="item2" href="/interopmatrices.html">Interoperability</a>
    <a class="item2" href="/certs.html">Partner Certifications</a>
    </div>
    <a class="item3 arrow" href="javascript:void(0)">Support & Service<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
    <div style="border: 2px; #FFFFFF" class="section">
    <a class="item2" href="/techsupt.html">Contact Tech Support</a>
    <a class="item2" href="<?php echo $info_url; ?>">Troubleshooting Tips & FAQs</a>
    <a class="item2" href="/warrantyinfo.html">Warranty Information</a>
    <a class="item2" href="/license.php">Authorize Products</a>
    <a class="item2" href="/registration.php">Register Products</a>
    <a class="item2" href="/services/index.html">Service Programs</a>
    </div>
    <a class="item3 arrow" href="javascript:void(0)">Request Information<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
    <div style="border: 2px; #FFFFFF" class="section">
    <a class="item2" href="/oem.html">Request Sales Support</a>
    <a class="item2" href="/techsupt.html">Request Technical Support</a>
    </div>
    <a class="item3 arrow" href="javascript:void(0)">Solutions<img src="/images/arrow3.gif" width="10" height="12" alt="" /></a>
    <div style="border: 2px; #FFFFFF" class="section">
    <a class="item2" href="/oemsolutions.html">OEM</a>
    <a class="item2" href="/digitalcc.html">Digital Content Creation</a>
    <a class="item2" href="/business.html">Backup</a>
    </div>

    <?php
    if ($url15 != "") {
    echo "<a class=\"item3 arrow\" href=\"javascript:void(0)\">$url13";
    echo "<img src=\"/images/arrow3.gif\" width=\"10\" height=\"12\" alt=\"\" /></a>\n";
    echo "<div style=\"border: 2px; #FFFFFF\" class=\"section\">\n";
    echo "<a class=\"item2\" href=\"$url15_url\">$url15</a>\n</div>\n";
    }
    ?>
    </td>
    </tr>
    </table><!-- #EndLibraryItem >



Page 2 of 2 First 1 2

Tags for this Thread