Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have used the following code:


PHP
$doc = new DOMDocument;
$doc->validateOnParse = true;
$doc->loadHTML('index.html');
$doc->getElementById('events');


now is there any way to directly access the inner html of that variable? like in js we have .innerHTML and .outterHTML

is there a similar simple code in php? i just want to access the elements of it.
Posted

1 solution

Normally, you would store the result of getElementById('events') to a variable, call getElementsByTagName, and then iterate on each node. But Drupella has written some code[^] that will allow you to get the innerHTML without iterating.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900