Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Menu
- {
- private $enlace=array();
- private $titulo=array();
- public function opcion($en,$ti)
- {
- $this->enlace[]=$en;
- $this->titulo[]=$ti;
- }
- public function mostrarMenu()
- {
- for ($i=0; $i < count($this->enlace); $i++)
- {
- echo '<a href="'.$this->enlace[$i].'">'.$this->titulo[$i].'</a>';
- echo ' - ';
- }
- }
- public function mostrarMenuVertical()
- {
- for ($i=0; $i < count($this->enlace); $i++)
- {
- echo '<a href="'.$this->enlace[$i].'">'.$this->titulo[$i].'</a>';
- echo ' - ';
- }
- }
- }
- $miMenu = new Menu();
- $miMenu -> opcion("http://www.tuwebonada.com","Tuwebonada");
- $miMenu -> opcion("http://www.google.com","Google");
- $miMenu -> opcion("http://www.twitter.com","Twitter");
- $miMenu -> mostrarMenu();
- echo "<hr>";
- $miMenu2 = new Menu();
- $miMenu2 -> opcion("http://www.msn.com","MSN");
- $miMenu2 -> opcion("http://www.gmail.com","Gmail");
- $miMenu2 -> opcion("http://www.yahoo.com","Yahoo");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement