Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   More help with PHP menus? 2nd level ideas. (OT to some). (http://www.velocityreviews.com/forums/t599177-more-help-with-php-menus-2nd-level-ideas-ot-to-some.html)

Mike Barnard 03-16-2008 11:18 AM

More help with PHP menus? 2nd level ideas. (OT to some).
 
Hi again.

[For those of you that think PHP is off topic, sorry, but this has
been the best forum for help I have found so far and I have been
invited to continue to discuss this subject here.]

Bootnic offered me a simple PHP menu include which is fantastic.
Thanks again. I have been trying to improve on it by adding a second
level of menus. However, I am very new to PHP and I can't decide on
which is the best methodology to do it.

Obviously, the PHP script is only processed when the page is requested
from the server. Therefore, in order to have a second level of menus
show when a user hovers over a first level menu item, the browser has
to do the work in showing it. This removes PHP itself from the agenda
at this stage.

Javascript would be one way I'm sure and there are loads of such
systems available for use. But I don't trust that all browserss will
have JS running so I wish to rely on PHP, HTML and CSS.

The only way I can think of for a second ( or more?) level to work
with these restrictions is for the menus for *ALL* levels to be
created by the PHP script when the page is called, but the CSS
properties of the unwanted lists be set such that they can't be seen.
Maybe by absolute positioning, sending them off screen until a hover
changes thier locations, or by setting thier colours to transparent or
something, or maybe using Z indexs to hide them under the rest. Or
something else?

I do not want to reinvent the wheel. I wonder if someone can help by
explaining the most efficient methodology, and why it is. I'm happy to
try and create my own scripts, I do not expect it to be handed to me
on a plate, but I do not have enough knowledge and experience to get
the best from this without some advice. If anyone would like to take
the time to comment (nicely!) I would really apprecieate it.

Thanks, again.

Mike.

Mike Barnard 03-16-2008 01:35 PM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
On Sun, 16 Mar 2008 11:18:43 +0000, Mike Barnard
<m.barnard.trousers@thunderin.co.uk> wrote:

>Hi again.
>
>[For those of you that think PHP is off topic, sorry, but this has
>been the best forum for help I have found so far and I have been
>invited to continue to discuss this subject here.]
>
>Bootnic offered me a simple PHP menu include which is fantastic.
>Thanks again. I have been trying to improve on it by adding a second
>level of menus. However, I am very new to PHP and I can't decide on
>which is the best methodology to do it.


In another forum it has been sugessted that Javascript is a more
reliable way to go. This article was pointed out to me.

http://www.howtocreate.co.uk/tutorials/testMenu.html

1. How many users will fail because they have no javascript allowed
compared to those who don't have browsers modern enough to use pure
css menus?

2. How does this hang in with the original intention, of having a
SINGLE menu file that gets included on the page html?

PHP / CSS or Javascript too? What is the consensus please?


BootNic 03-16-2008 02:39 PM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
Mike Barnard <m.barnard.trousers@thunderin.co.uk> wrote in
news:cdvpt3dfc4hi904duangdku2ljrj7s09ck@4ax.com:

[snip comments on expanding menus & PHP]

It's time for you to provide a url. If you do not have a host you may
find a free host.

http://www.leadhoster.com/signup.html

The above url is one place where you may get a free host that offers php
and no adds. Apache version 1 something and php version 4 something. It
also has FTP access.

Once set up you may build a mock-up of what your website may look like,
in this case a mock-up of your menu and directory structure.

For the newsgroups keep it bare as possible, only what is required for
your current discussion.

For your menu or site navigation, I think the most important part is a
sitemap. A link to your sitemap on every page.

Expanding menus. I suggest you not do any kind of expanding menu. What I
suggest is that you expand your current directory, which can be done with
php. That can be discussed more after you get a mock-up site set up, with
a sitemap and menus in place.

Google is your friend, you may search the newsgroups for discussion on
the use of expanding menus.

Regardless of what path you take with your menu, build your mock-up, in
that way more will likely offer comments or help.

--
BootNic Sunday March 16, 2008 10:39 AM
Complaining is good for you as long as you're not complaining to the
person you're complaining about.
*Lynn Johnston*

Ed Mullen 03-16-2008 07:44 PM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
Mike Barnard wrote:
> Hi again.
>
> [For those of you that think PHP is off topic, sorry, but this has
> been the best forum for help I have found so far and I have been
> invited to continue to discuss this subject here.]
>
> Bootnic offered me a simple PHP menu include which is fantastic.
> Thanks again. I have been trying to improve on it by adding a second
> level of menus. However, I am very new to PHP and I can't decide on
> which is the best methodology to do it.
>
> Obviously, the PHP script is only processed when the page is requested
> from the server. Therefore, in order to have a second level of menus
> show when a user hovers over a first level menu item, the browser has
> to do the work in showing it. This removes PHP itself from the agenda
> at this stage.
>
> Javascript would be one way I'm sure and there are loads of such
> systems available for use. But I don't trust that all browserss will
> have JS running so I wish to rely on PHP, HTML and CSS.
>
> The only way I can think of for a second ( or more?) level to work
> with these restrictions is for the menus for *ALL* levels to be
> created by the PHP script when the page is called, but the CSS
> properties of the unwanted lists be set such that they can't be seen.
> Maybe by absolute positioning, sending them off screen until a hover
> changes thier locations, or by setting thier colours to transparent or
> something, or maybe using Z indexs to hide them under the rest. Or
> something else?
>


The menu system on my site uses two levels in some parts. It is
included into each of the 200+ pages via a server-side PHP include:

<?php include("./styles/menu.txt"); ?>

Go to link below and View Source to see all the menu code.

You can also see the CSS styling of the menu in:

http://edmullen.net/styles/default.css

and the actual menu file at:

http://edmullen.net/styles/menu.txt

The system is from:

http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp

Not saying it's the best one but it does work.

--
Ed Mullen
http://edmullen.net
If a turtle doesn't have a shell, is he homeless or naked?

Neredbojias 03-16-2008 08:36 PM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
On 16 Mar 2008, Ed Mullen wrote:

Ed Mullen
http://edmullen.net
If a turtle doesn't have a shell, is he homeless or naked?

In either case, he'd probably be shell-shocked.

--
Neredbojias
http://www.neredbojias.com/
Great sights and sounds

dorayme 03-16-2008 10:00 PM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
In article <cdvpt3dfc4hi904duangdku2ljrj7s09ck@4ax.com>,
Mike Barnard <m.barnard.trousers@thunderin.co.uk> wrote:

> Hi again.
>
> [For those of you that think PHP is off topic, sorry, but this has
> been the best forum for help I have found so far and I have been
> invited to continue to discuss this subject here.]
>
> Bootnic offered me a simple PHP menu include which is fantastic.
> Thanks again. I have been trying to improve on it by adding a second
> level of menus. However, I am very new to PHP and I can't decide on
> which is the best methodology to do it.


I am surprised you are so keen to race so far ahead. There are
downsides to multi-level menus that should surely put them on the
back-burner till you get other things well on your site.

What have you done about your wife's hat or the logo? <g>

What about the basics, you happy with it yet?

--
dorayme

Ed Mullen 03-17-2008 02:44 AM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
Neredbojias wrote:
> On 16 Mar 2008, Ed Mullen wrote:
>
> Ed Mullen
> http://edmullen.net
> If a turtle doesn't have a shell, is he homeless or naked?
>
> In either case, he'd probably be shell-shocked.
>


And, perhaps, in the soup.

--
Ed Mullen
http://edmullen.net
Deja Roo: What? ANOTHER kagaroo?!!!

Neredbojias 03-17-2008 04:40 AM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
On 16 Mar 2008, Ed Mullen wrote:

> Neredbojias wrote:
>> On 16 Mar 2008, Ed Mullen wrote:
>>
>> Ed Mullen
>> http://edmullen.net
>> If a turtle doesn't have a shell, is he homeless or naked?
>>
>> In either case, he'd probably be shell-shocked.
>>

>
> And, perhaps, in the soup.


<grin>

--
Neredbojias
http://www.neredbojias.com/
Great sights and sounds

Mike Barnard 03-17-2008 12:49 PM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
On Sun, 16 Mar 2008 14:39:49 +0000 (UTC), BootNic
<bootnic.bounce@gmail.com> wrote:

>Mike Barnard <m.barnard.trousers@thunderin.co.uk> wrote in
>news:cdvpt3dfc4hi904duangdku2ljrj7s09ck@4ax.com :
>
>[snip comments on expanding menus & PHP]


Good afternoon. (For me here in the UK.)

>It's time for you to provide a url.


www.thermachek.com/temp/index.php

>Once set up you may build a mock-up of what your website may look like,
>in this case a mock-up of your menu and directory structure.


More than a mockup, but a lot to be filled in yet. As the PHP stuff is
processed, it means that you cannot see the code. Therefore it is cut
n pasted at the end of this message.

>For your menu or site navigation, I think the most important part is a
>sitemap. A link to your sitemap on every page.


Its not totally defined yet. You will see from the above link that the
'home' link is not yet styled. I want to add a second layer of menus
to the items titled "The Law" and "Guides for...".

>Expanding menus. I suggest you not do any kind of expanding menu. What I
>suggest is that you expand your current directory, which can be done with
>php. That can be discussed more after you get a mock-up site set up, with
>a sitemap and menus in place.


I don't understand the difference between an expanding menu and an
expanding directory. A google search for both shows that I understand
(and want, ideally) expanding menus but makes no sense of expanding
directories.

>Google is your friend,


I spend a lot of time hand in hand with my mate Google.

> you may search the newsgroups for discussion on
>the use of expanding menus.


I have done. Many thanks for you attempts to educate me. :)

Mike.





***The PHP ***

The code in the index.php file is simply an include to the menu file.
<?php include('mainmenu.php');?>

The mainmenu.php file itself consists of the following. It is your
script with slight alterations and notes to myself on how it works. It
looks MUCH tidier in my version of NoteTabPro, It has not cut n pasted
perfectly.


<ul id="navlist">

<?php

//Menu array. Builds the array and puts the page names and keys in.
//The left item is the 'key', the right the array content.
$menu = array
(
"/index.php" => "Home",
"/law.php" => "The Law",
"/glossary.php" => "Glossary of terms",
"/selfassess.php" => "Guides for self assessment",
"/hireme.php" => "Hire a professional assessor",
"/contact.php" => "Contact me",
"/Links.php" => "Useful links",
"/Disclaimer.php" => "Disclaimer",
);


// Get the name of the current page.
// Contains the current script's path.
$full_path_of_page = $_SERVER["SCRIPT_NAME"];

// For testing purposes
echo "The variable \$full_path_of_page is holding the value of: ";
echo $full_path_of_page;

// Shorten it to the last forward slash and characters to its
right, the actual file
// name without the path.
$current_page = strrchr($full_path_of_page,"/");

// For testing purposes
echo "<br>";echo "<br>";
echo "The variable \$current_page is holding the value of: ";
echo $current_page;

//Build menu items
//foreach loops over the array given by array expression [$menu]. On
each loop, php looks at the $key element of the
//array, takes the content of the $key and places it into $value.

foreach ($menu as $key => $value) //Counts through the
loop.
{
echo " <li>\n"; //Creates the first part
of an HTML list item.
if ($key === $current_page) //If the item is the
current page then...
{
echo " <span>$value</span>\n"; //...just display a text with no
anchor
}
else //But if the item is NOT the current page...
{
echo " <a href=\"$key\">$value</a>\n"; //...then display an anchor
pointing to the page.
}
echo " </li>\n"; //Finish the HTML <li>
}
?>
</ul>

Mike Barnard 03-17-2008 12:56 PM

Re: More help with PHP menus? 2nd level ideas. (OT to some).
 
On Sun, 16 Mar 2008 15:44:17 -0400, Ed Mullen <ed@edmullen.net> wrote:

>Mike Barnard wrote:


Hi Ed.

>The menu system on my site uses two levels in some parts. It is
>included into each of the 200+ pages via a server-side PHP include:
>
><?php include("./styles/menu.txt"); ?>
>
>Go to link below and View Source to see all the menu code.
>
>You can also see the CSS styling of the menu in:
>
>http://edmullen.net/styles/default.css
>
>and the actual menu file at:
>
>http://edmullen.net/styles/menu.txt
>
>The system is from:
>
>http://www.tanfa.co.uk/css/examples/menu/tutorial-h.asp
>
>Not saying it's the best one but it does work.


Thanks for the help. Thats the effect I'm looking for, but I didn't
know how I could include the menu files the way you have done. It
may *BE* the best, I wouldn't know, but as long as it works on the
vast majority of the browsers out there who cares about it being
'best'. Cheers.




All times are GMT. The time now is 06:31 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.