Mobile Friendly Website

CSSPLAY

Doing it with style

Doors drop-line three COMMENTS

Welcome to my Comments Pages

Please note. I get a few hundred emails a week from visitors asking for help, or posing questions on how to modify my demos to suit their application and I read them all. Unfortunately I only have a limited amount of time to spend answering these questions.

So if I do not reply, please do not be offended, and if I do reply then you are one of the lucky ones.

If you are asking for permission to use any of my demonstration then please email me with your request stu{at}cssplay.co.uk.

Post a comment


Current posts

Stu:-
Mike, I think you are missing the point. Normally a click on a tab will take you to a new page where you will have the clicked tab styled with 'selected'.
On my demo, to save having 12 pages, I just reload the same page and with a little php programming I write 'selected' to the clicked tab style.
(24.02.2007, 23:44)

Mike:-
OK - I was thinking that there might be a bit of missing PHP...I have used case/switch before, but this seems easier to manage.

What is the PHP script like to make the clicked tab 'selected'?

Willing to make a donation at this point!

$10 ok?

:)

Thanks for any help.

Mike
mike @ dcsdigi.com
(24.02.2007, 23:48)

Gregg:-
I am having the same problem as Mike.

Does this mean that for 12 pages I would need to have 12 different versions of the menu?

Sorry may seem like a silly question but am also a little stumped as to how to get the "clicked" state.
(25.02.2007, 08:05)

Stu:-
Mike, Greg, how would you be using this menu? Are you using an extenal menu file that is 'included' at run time using php? If so then you could use my method of using a query string at the end of the link page url.
The external file would then read this query string and using the php 'if/else' would write 'selected' into the current page style.
(25.02.2007, 09:07)

Mike:-
OK - thanks Stu - that gives me something to work with - I just need to figure out how to get the 'if/else' to write selected as part of my php case/switch. Here is a bit of what I'm talking about:

<?
switch ($page) {
case "clients":
include('clients.php');
break;
case "resources":
include('resources.php');
break;
default:
include('content_main.php');
}
?>

I guess that afer each 'include' statement above, I would have to put in the if/else statement to write 'selected' to the correct menu item.

Thanks,

Mike
(25.02.2007, 13:56)

Gregg:-
Thanks Mike

That switch code is helpful. Would you mind also sharing a sample of the if/else statement to write the "selected" section into the html/css.

Thanks
(25.02.2007, 14:09)

Stu:-
Ok, firstly I set up a 'default' selected menu then read the query string.
<?php
$current = "two";
$sub="c";
if (isset($_GET['current'])) $current = $_GET['current'];
if (isset($_GET['sub'])) $sub = $_GET['sub'];
?>

Then the if/else use:

<div id="nav">


<?php
if ($current == "one")
{
echo "<ul class=\"current\">";
}
else {
echo "<ul class=\"select\">";
}
?>
<li><a href="doors_drop_line_three.html?current=one&amp;sub=none"><b>January</b>

etc....
(25.02.2007, 14:17)

Mike:-
No problem Gregg - I'm hoping that perhaps Stu could elaborate on how to incorporate the if/else statement into the above php to work with his menu.

Given the case/switch though, I don't think we need an if/else statement in there - since each case has a defined include. I think we need to just write selected to the relative menu/submenu selection based on the case, or query that is passed back to the php script above.

We're getting closer to a solution...
(25.02.2007, 14:29)

Mike:-
Thanks Stu - I think I understand it now.

I'll have to write an if/else to handle the sub menu options as well, right? So there would be 12 if/else statements to handle the core navigation, and as many sub if/else statements as desired (4 or 5 in your example).

Or maybe what this does is keep the sub menu active for that particular 'current' menu selection, then from there you just have a/hover states for the subs - no need to if/else.

Am I right?

thanks,

Mike
(25.02.2007, 14:47)

Stu:-
You can always use the case="clients" etc to set up the included menu with the required 'selected' classes so there will be no need to use a further if/else test.
(25.02.2007, 15:32)

10 of 29 comments (part 2). [ « ] [ » ] [ * ]



Post

Your comment:

Your Name:

Stu's First Name - 3 letters (required)

Thanks to Alex for this script.

Please enter your comments for this site page.
Please note that all posts are moderated.

Posting rules

HTML is turned off
Maximum word length is 80 characters.
Messages limited to 1200 characters.
Web links should not include 'http://'

Support CSSPLAY

Your donations keep CSS PLAY running.
If your donation is for the use of a demo then please email me with the demo url after making your donation.


CUSTOM SEARCH

Facebook Twitter rss feed Facebook Fan Page