Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think i have figured out what i was trying to achieve but not sure is that the right way. It is doing the job. Please leave comments or any other idea how can i improve it. If you go to the following site and type any URL. It will produce a report with accessibility issues in a webpage. It is an accessibility checker tool.</p> <pre><code>http://valet.webthing.com/page/ </code></pre> <p>All i am trying to do is achieve that kind of layout. The code below will produce the DOM of supplied URL and find any image tag that does not have alternative text.</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;?php $dom = new domDocument; // load the html into the object $dom-&gt;loadHTMLFile('$yourURLAddress'); // keep white space $dom-&gt;preserveWhiteSpace = true; // nicely format output $dom-&gt;formatOutput = true; $new = htmlspecialchars($dom-&gt;saveHTML(), ENT_QUOTES); $lines = preg_split('/\r\n|\r|\n/', $new); //split the string on new lines echo "&lt;pre&gt;"; //find 'alt=""' and print the line number and html tag foreach ($lines as $lineNumber =&gt; $line) { if (strpos($line, htmlspecialchars('alt=""')) !== false) { echo "\r\n" . $lineNumber . ". " . $line; } } echo "\n\n\nBelow is the whole DOM\n\n\n"; //print out the whole DOM including line numbers foreach ($lines as $lineNumber =&gt; $line) { echo "\r\n" . $lineNumber . ". " . $line; } echo "&lt;/pre&gt;"; ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I like to thank everyone who helped specially "chwagssd" and Mike Johnson.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload