Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/04/2011, 06:00
Avatar de masterpuppet
masterpuppet
Software Craftsman
 
Fecha de Ingreso: enero-2008
Ubicación: Montevideo, Uruguay
Mensajes: 3.550
Antigüedad: 16 años, 3 meses
Puntos: 845
Respuesta: Cual son las formas de añadir un atributo a un enlace

Que tal gachon,

Podrias utilizar DOMDocument, algo asi:

Código PHP:
Ver original
  1. $dom = new DOMDocument();
  2.  
  3. $dom->loadHTMLFile($path);
  4.  
  5. foreach($dom->getElementsByTagName('a') as $link) {
  6.     $link->setAttribute('rel', 'nofollow');
  7. }
  8.  
  9. $dom->saveHTMLFile($path);

Saludos.
__________________
http://es.phptherightway.com/
thats us riders :)