another stumbling block

J

John Salerno

This is similar to my question about how to change things when using a
PHP include. I'm using this markup for a navigation menu:

<div id="navlist">
<ul class="menu">
<li id="uberlink"><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Links</a></li>
<li><a href="#">Page Four</a></li>
<li><a href="#">Page Five</a></li>
</ul>
</div>


To make the current page stay highlighted, you use the uberlink id. But
this seems to suggest that you must put this markup in each page
separately, and manually change the id each time (move it to Blog for
that page, to Links for that page, etc.).

I'd rather use a PHP include to insert this markup on each page, but how
would I do that and also be sure that the proper element gets the id?
 
M

Mark Parnell

Deciding to do something for the good of humanity, John Salerno
I'd rather use a PHP include to insert this markup on each page, but how
would I do that and also be sure that the proper element gets the id?

Didn't you ask that the other day? Or was it someone else?

<li<?php if(basename($_SERVER['PHP_SELF']) == 'location.php') {print('
id="uberlink"');} ?>>Home</li>
 
J

John Salerno

Mark said:
Deciding to do something for the good of humanity, John Salerno
I'd rather use a PHP include to insert this markup on each page, but how
would I do that and also be sure that the proper element gets the id?

Didn't you ask that the other day? Or was it someone else?

<li<?php if(basename($_SERVER['PHP_SELF']) == 'location.php') {print('
id="uberlink"');} ?>>Home</li>

Yeah, I asked a similar question but I guess I don't know enough about
PHP to really get this yet. I'll have to do some research on the line of
code you gave above.

Thanks!
 
J

Jonathan N. Little

John said:
Mark said:
Deciding to do something for the good of humanity, John Salerno
I'd rather use a PHP include to insert this markup on each page, but
how would I do that and also be sure that the proper element gets the
id?


Didn't you ask that the other day? Or was it someone else?

<li<?php if(basename($_SERVER['PHP_SELF']) == 'location.php') {print('
id="uberlink"');} ?>>Home</li>

Yeah, I asked a similar question but I guess I don't know enough about
PHP to really get this yet. I'll have to do some research on the line of
code you gave above.


http://www.php.net/docs.php
PHP: Documentation
 
J

John Salerno

Mark said:
Deciding to do something for the good of humanity, John Salerno
I'd rather use a PHP include to insert this markup on each page, but how
would I do that and also be sure that the proper element gets the id?

Didn't you ask that the other day? Or was it someone else?

<li<?php if(basename($_SERVER['PHP_SELF']) == 'location.php') {print('
id="uberlink"');} ?>>Home</li>

Hmm, but what if I want to put the entire block of menu items into a PHP
file and include() that in the HTML file? The above wouldn't work,
because it still uses a page by page method.
 
M

Mark Parnell

Deciding to do something for the good of humanity, John Salerno
Hmm, but what if I want to put the entire block of menu items into a PHP
file and include() that in the HTML file?

That's what my post was intended for.
The above wouldn't work,
because it still uses a page by page method.

Just put all the links together.

<ul id="main-menu">
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location.php') {print('
id="uberlink"');} ?>>Home</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location2.php') {print('
id="uberlink"');} ?>>Another Place</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location3.php') {print('
id="uberlink"');} ?>>Somewhere Else</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location4.php') {print('
id="uberlink"');} ?>>Yet Another Location</li>
</ul>
 
J

John Salerno

Mark said:
Deciding to do something for the good of humanity, John Salerno
Hmm, but what if I want to put the entire block of menu items into a PHP
file and include() that in the HTML file?

That's what my post was intended for.
The above wouldn't work,
because it still uses a page by page method.

Just put all the links together.

<ul id="main-menu">
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location.php') {print('
id="uberlink"');} ?>>Home</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location2.php') {print('
id="uberlink"');} ?>>Another Place</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location3.php') {print('
id="uberlink"');} ?>>Somewhere Else</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location4.php') {print('
id="uberlink"');} ?>>Yet Another Location</li>
</ul>

Oh! Geez, I really need a PHP book... :)
 
J

Jonathan N. Little

John said:
Mark said:
Deciding to do something for the good of humanity, John Salerno
Hmm, but what if I want to put the entire block of menu items into a
PHP file and include() that in the HTML file?


That's what my post was intended for.
The above wouldn't work, because it still uses a page by page method.


Just put all the links together.

<ul id="main-menu">
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location.php') {print('
id="uberlink"');} ?>>Home</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location2.php') {print('
id="uberlink"');} ?>>Another Place</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location3.php') {print('
id="uberlink"');} ?>>Somewhere Else</li>
<li<?php if(basename($_SERVER['PHP_SELF']) == 'location4.php') {print('
id="uberlink"');} ?>>Yet Another Location</li>
</ul>

Oh! Geez, I really need a PHP book... :)

I got some but many are pretty poor in IMHO, learned more from:

http://www.php.net/docs.php
PHP: Documentation

(Wished PHP authors utilized more function arguments then so many dang
core functions!)
 
D

dorayme

Jonathan N. Little said:
I got some but many are pretty poor in IMHO, learned more from:

http://www.php.net/docs.php
PHP: Documentation

(Wished PHP authors utilized more function arguments then so many dang
core functions!)

I notice that in Safari, a Mac OS X browser, (but not in Firefox,
not even in IE for Mac on 9) this page requires about 1800px wide
to display the text in the contents section. The text won't wrap!
I had to have it hanging out onto another screen beyond the 1600
px of the main one to see all the para without scrolling. Have
not investigated the cause... Safari is often very picky, what
has it picked on here or is it broken in some respect?
 
D

dorayme

dorayme said:
I notice that in Safari, a Mac OS X browser, (but not in Firefox,
not even in IE for Mac on 9) this page requires about 1800px wide
to display the text in the contents section. The text won't wrap!
I had to have it hanging out onto another screen beyond the 1600
px of the main one to see all the para without scrolling. Have
not investigated the cause... Safari is often very picky, what
has it picked on here or is it broken in some respect?

Would everyone please stop investigating this right now. Jonathan, take
that new Mac back to the store, there was no need... It was caused by a
corrupted preference (probably) in my copy of Safari.
 
J

Jonathan N. Little

D

dorayme

Would everyone please stop investigating this right now. Jonathan, take
that new Mac back to the store, there was no need...

What-what? What Mac? I was talking about PHP books! I don't have a Mac
and as an artist that has to deal with Mac-centric printers, well don't
get me started! ;-)

http://superbasspond.com/turnakit/comedy/Apple_Switch_Parody_DivX.avi

It was caused by a
corrupted preference (probably) in my copy of Safari.
[/QUOTE]

It's ok Jonathan, I was imagining (because - sad to say - it
amuses me), that everyone at alt.html runs about on my every word
and problem, and that you, being one of the most helpful around
here, would even go to the trouble of buying a Mac, getting
Safari and seeing what prob I was alluding to...

:)
 
J

Jonathan N. Little

dorayme wrote:

It's ok Jonathan, I was imagining (because - sad to say - it
amuses me),

Imagination, yep it can be a good thing, just as long as it not
delusion, oh but that politics! ;-)
that everyone at alt.html runs about on my every word
and problem,

Hmm really? Pay no mind. Once and a while I will get irked but then I
take a breath, reflect and try to move on.
and that you, being one of the most helpful around
here,

<blush>

Really it is just that I am procrastinating learning SQL for MySQL!
would even go to the trouble of buying a Mac, getting
Safari and seeing what prob I was alluding to...

Actually you may know me too well! I have contemplated getting a use Mac
for testing and debugging and all. Having custom built nearly all my
PC's, (well lets see, the 8088's were bought but the first was a '286
clone!) been frustrated when dealing with Mac-ites that when presented
with a problem file or program -- that is it 'It cannot be done!'

<duck and cover> sorry but that has been my experience!


PC/MS combo was great challenge with all the little snafus that drove
the hacking spirit! Should have gotten into Linux sooner, now I don't
have the time, so I just get my servers up and running and forget them.
I still haven't had time to test out a Fedora workstation to tryout
Linux desktop...but if Vista turns out to be what I think it will and my
Win2K becomes too obsolete well...
 
D

dorayme

Jonathan N. Little said:
Actually you may know me too well! I have contemplated getting a use Mac
for testing and debugging and all. Having custom built nearly all my
PC's, (well lets see, the 8088's were bought but the first was a '286
clone!) been frustrated when dealing with Mac-ites that when presented
with a problem file or program -- that is it 'It cannot be done!'

<duck and cover> sorry but that has been my experience!

My experience has been that the Mac community is very helpful.
There are not many files that a Mac cannot somehow open. If you
want to have some fun, get a 7300 or 7600 or even a 9600
Powermac, they are very easy to open and fiddle about with, are
upgradeable and can be got for next to nothing. It is a cheapish
hobby. There are some terrific Mac groups you can join to discuss
issues...
 
R

Richard Sexton

My experience has been that the Mac community is very helpful.
There are not many files that a Mac cannot somehow open. If you
want to have some fun, get a 7300 or 7600 or even a 9600
Powermac, they are very easy to open and fiddle about with, are
upgradeable and can be got for next to nothing. It is a cheapish
hobby. There are some terrific Mac groups you can join to discuss
issues...

The fruit flavour iMacs sell for peanuts on craigslist. I picked up 2
for $175. Great little things for spare ssh terminals.
 
D

dorayme

<doraymebutuse777insubjectline-9F83D9.12124217022006@news-vip.optusnet.com.au>
,


The fruit flavour iMacs sell for peanuts on craigslist. I picked up 2
for $175. Great little things for spare ssh terminals.

That is exactly what you should not get if you want to have fun
with the machine itself...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top