Advertisement
Guest User

algo

a guest
Jul 18th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <?php
  2. class Menu
  3. {
  4. private $enlace=array();
  5. private $titulo=array();
  6.  
  7. public function opcion($en,$ti)
  8. {
  9. $this->enlace[]=$en;
  10. $this->titulo[]=$ti;
  11. }
  12.  
  13. public function mostrarMenu()
  14. {
  15. for ($i=0; $i < count($this->enlace); $i++)
  16. {
  17. echo '<a href="'.$this->enlace[$i].'">'.$this->titulo[$i].'</a>';
  18. echo ' - ';
  19. }
  20. }
  21.  
  22. public function mostrarMenuVertical()
  23. {
  24. for ($i=0; $i < count($this->enlace); $i++)
  25. {
  26. echo '<a href="'.$this->enlace[$i].'">'.$this->titulo[$i].'</a>';
  27. echo ' - ';
  28. }
  29. }
  30. }
  31.  
  32. $miMenu = new Menu();
  33. $miMenu -> opcion("http://www.tuwebonada.com","Tuwebonada");
  34. $miMenu -> opcion("http://www.google.com","Google");
  35. $miMenu -> opcion("http://www.twitter.com","Twitter");
  36. $miMenu -> mostrarMenu();
  37.  
  38. echo "<hr>";
  39.  
  40. $miMenu2 = new Menu();
  41. $miMenu2 -> opcion("http://www.msn.com","MSN");
  42. $miMenu2 -> opcion("http://www.gmail.com","Gmail");
  43. $miMenu2 -> opcion("http://www.yahoo.com","Yahoo");
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement