Is there any better way then defining the function for this code in PHP?

xXxlolxXx

New Member
I have an HTML menu and i have styled it with CSS to highlight the current page. as i have more then 8 pages using the same code. i wanted to do something dynamic and i created a PHP function for that,here is my code..\[code\] <?php function hiddenmenu($activeicon1 = 0, $activeicon2 = 0, $activeicon3 = 0, $activeicon4 = 0, $activeicon5 = 0, $activeicon6 = 0, $activeicon7 = 0, $activeicon8 = 0, $activeicon9 = 0) { ?> <div class="icon-no-spacer"> <p><a id="<?php echo $activeicon1; ?>" href="http://stackoverflow.com/questions/3654136/index.php" title=""><img src="http://stackoverflow.com/questions/3654136/images/icons/48/display.png" alt="" />Dashboard</a></p> </div> <div class="icon-spacer"> <p><a id="<?php echo $activeicon2; ?>" href="http://stackoverflow.com/questions/3654136/post-news.php" title=""><img src="http://stackoverflow.com/questions/3654136/images/icons/48/text_rtf.png" alt="" />Post News</a></p> </div> <div class="icon-spacer"> <p><a id="<?php echo $activeicon3; ?>" href="http://stackoverflow.com/questions/3654136/news.php" title=""><img src="http://stackoverflow.com/questions/3654136/images/icons/48/wordprocessing.png" alt="" />News</a></p> </div> <div class="icon-spacer"> <p><a id="<?php echo $activeicon4; ?>" href="http://stackoverflow.com/questions/3654136/post-advertisement.php" title="" ><img src="http://stackoverflow.com/questions/3654136/images/icons/48/view_pim_news.png" alt="" />Post Ad</a></p> </div> <div class="icon-spacer"> <p><a id="<?php echo $activeicon5; ?>" href="http://stackoverflow.com/questions/3654136/advertisement.php" title=""><img src="http://stackoverflow.com/questions/3654136/images/icons/48/view_pim_tasks.png" alt="" />Advertise</a></p> </div> <div class="icon-spacer"> <p><a id="<?php echo $activeicon6; ?>" href="http://stackoverflow.com/questions/3654136/comments.html" title=""><img src="http://stackoverflow.com/questions/3654136/images/icons/48/spread.png" alt="" />Comments</a></p> </div> <div class="icon-spacer"> <p><a id="<?php echo $activeicon7; ?>" href="http://stackoverflow.com/questions/3654136/#" title=""><img src="http://stackoverflow.com/questions/3654136/images/icons/48/rss_tag.png" alt="" />Sponsors</a></p> </div> <div class="icon-spacer"> <p><a id="<?php echo $activeicon8; ?>" href="http://stackoverflow.com/questions/3654136/#" title=""><img src="http://stackoverflow.com/questions/3654136/images/icons/48/fileview_preview.png" alt="" />Video</a></p> </div> <div class="icon-spacer"> <p><a id="<?php echo $activeicon9; ?>" href="http://stackoverflow.com/questions/3654136/information.php" title="" ><img src="http://stackoverflow.com/questions/3654136/images/icons/48/help_about.png" alt="" />Information</a></p> </div> <?php } ?>\[/code\]the code is working perfectly fine. is it ok to go with this. ?? lot of people might have come accross this type of issue i want to know the best feasible solution for this..thank you
 
Back
Top