On Monday, December 27, 2010 04:53:08 pm David McGlone wrote:
> On Monday, December 27, 2010 04:47:34 pm Michelle Konzack wrote:
> > Hello David McGlone,
> >
> > Am 2010-12-27 16:13:50, hacktest Du folgendes herunter:
> > > foreach ($services as $service){
> > >
> > > echo "<ul><li>» <a
> > > href=index.php?page=$service>$service</a></li></ul>"; }
> > >
> > > Could anyone give me a hand? Obviously I don't understand arrays very
> > > well :-/
> >
> > Maybe:
> >
> > echo "<ul><li>» <a href=index.php?page=$service><?php
> > str_replace("_", " ", $service); =?></a></li></ul>";
>
> Hehehehe :) I'm gonna try this too. Earlier I was thinking of str_replace,
> but couldn't figure out how I would incorporate it.
>
> I love PHP!
Ok here's another variation with the str_replace suggestion
function links() {
$services = array("lawn_maintenance", "core_areation", "over_seeding",
"hedge_trimming", "mulch_installation", "natural_debris_removal",
"leaf_removal", "snow_plowing");
foreach ($services as $service){
$replace = str_replace("_", " ", $service);
echo "<ul><li>» <a href=index.php?page=$service>$replace</a></li></ul>";
}
}
Thanks everyone. I'm stoked! :) I know this probably wasn't much for the
veteran coders here, but for me it was awesome. I was proud of myself when I
thought of using the array for the links and now this was an added bonus.
my next step will be using a database instead of a hard coded array, but at
this point I don't want to make things any harder on myself.
--
Blessings
David M.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php