Re: how would I do this?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, December 27, 2010 04:28:12 pm Nathan Nobbe wrote:
> On Mon, Dec 27, 2010 at 2:13 PM, David McGlone <david@xxxxxxxxxxxxx> wrote:
> > Hi all,
> > 
> > I am trying to make the link in this code not show the underscore and I
> > can't
> > figure out how I could do it. I've tried various different things I
> > thought would work. I've tried things like "lawn_maintenance"=> "lawn
> > maintenance", I
> > tried concatinating "lawn" . "maintenance" and various other things. The
> > examples above both produce just the word "lawn"
> > 
> >  here's the code I have so far:
> > $services = array(lawn_maintenance, core_areation, over_seeding,
> > hedge_trimming, mulch_installation, natural_debris_removal,
> > leaf_cleanup_removal, snow_plowing);
> > 
> > 
> > foreach ($services as $service){
> > 
> > echo "<ul><li>&raquo; <a
> > href=index.php?page=$service>$service</a></li></ul>";
> > }
> 
> just clean up the array definition:
> 
> $services = array('lawn_maintenance', 'core_areation', 'over_seeding',
> 'hedge_trimming', 'mulch_installation', 'natural_debris_removal',
> 'leaf_cleanup_removal', 'snow_plowing');
> 
> > Could anyone give me a hand? Obviously I don't understand arrays very
> > well
> > 
> > :-/
> 
> looks more like it's the strings you're struggling with ;)

probably is. :)

Ok I put quotes around each array, but I was still getting the underscore in 
the echo of the URL.

What I was trying to do was to remove the underscore in the echo Only, but 
keep it in the URL, well that seemed like too much to bite off at the moment, 
so what I did was removed the underscore in the array names and just named 
each page the first word of the array.

here's what I had:
$services = array('lawn_maintenance', 'core_areation', 'over_seeding',
> 'hedge_trimming', 'mulch_installation', 'natural_debris_removal',
> 'leaf_cleanup_removal', 'snow_plowing');

page names match array names (ie: lawn_maintenance, core_areation etc..)

here is what I now have:

$services = array('lawn maintenance', 'core areation', 'over seeding',
> 'hedge trimming', 'mulch installation', 'natural debris removal',
> 'leaf cleanup removal', 'snow plowing');

page names are only the first name of the array (ie: lawn, core, over, hedge, 
mulch, etc...)

Does that make any sense? LOL probably doesn't and it wasn't what I was 
shooting for, but hey it works.. :)

-- 
Blessings
David M.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux