citire/scriere in document html

Secţiune dedicată începatorilor.

Moderatori: Moderatori, Start Moderator


malahistul
PHPRomania Supporter
Mesaje: 11
Membru din: Dum Feb 22, 2009 10:54 pm

Mesajde malahistul » Mie Iul 01, 2009 12:31 am

combina php-ul cu putin javascript .. invata sa folosesti o librarie dintre cele existente ( de exemplu + ). foloseste un sistem de template-uri pt php ( de exemplu )

BBstrumf
PHPRomania Supporter
Mesaje: 21
Membru din: Lun Iun 08, 2009 4:27 pm

Mesajde BBstrumf » Mie Iul 01, 2009 12:45 am

hmm...cu javascript mi-ar fi foarte usor, dar nu vreau sa folosesc javascript...vreau sa fac doar cu php.

din ce am mai citit pana acum cred ca functiile din seria PCRE cu expresii regulate m-ar ajuta....dar inca nu am aprofundat pt ca nu sunt prea bun la expresii regulate :D

Avatar utilizator
kleampa
Senior Member
Mesaje: 2774
Membru din: Dum Iul 10, 2005 2:12 pm
Localitate: Bucuresti
Contact:

Mesajde kleampa » Mie Iul 01, 2009 12:48 am

DOMdocuments ar fi una din solutii

BBstrumf
PHPRomania Supporter
Mesaje: 21
Membru din: Lun Iun 08, 2009 4:27 pm

Mesajde BBstrumf » Mie Iul 01, 2009 10:11 pm


Avatar utilizator
Amenthes
Senior Member
Mesaje: 1370
Membru din: Lun Dec 12, 2005 8:00 am
Contact:

Mesajde Amenthes » Joi Iul 02, 2009 12:12 pm

Pentru HTML nu ai nevoie de getAttributeNS() ci de getAttribute(). Un
exemplu de folosire:

[php]
<?php

$html = '<a href=\'http://google.ro\'>google.ro</a>';

$dom = new DOMDocument;
$dom->loadHTML($html);

$links = $dom->getElementsByTagName('a');

foreach ($links as $link) {
$href = $link->getAttribute('href');

var_dump($href);
}

?>
[/php]
I'm under construction |


Înapoi la “PHP Incepători”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 12 vizitatori