Hello,
I'm putting together a php webpage which is parsing my (.html)
bookmarks list. I want to give them a new lay-out with php and CSS.
My question is:
How can I make a function that counts and strores the number of
bookmark links of each seperate(!) bookmarkfolder in a variable?
For example: the "<DT><H3>php</H3>" (see the html sample underneath)
is the php folder and I want to know how many links (in this case 3)
are in that folder and the same for the "<DT><H3>programming</H3>"
folder (2 items).
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DT><H3>php</H3>
<DL><p>
<DT><A HREF="http://www.w3schools.com/php/default.asp"
ID="rdf:#$ScZXl3">PHP Tutorial</A>
<DT><A HREF="http://www.php.net/" ID="rdf:#$TcZXl3">PHP: Hypertext
Preprocessor</A>
<DT><A HREF="http://www.phpdig.net/" ID="rdf:#$TfZXl3">PhpDig.net -
Web Spider and Search Engine</A>
</DL><p>
<DT><H3>programming</H3>
<DL><p>
<DT><A HREF="http://www.codebrain.com/java/gutenberg/index.html"
ID="rdf:#$qI7Ab2">GUTENBERG APPLET</A>
<DT><A HREF="http://www.w3schools.com/" ID="rdf:#$UcZXl3">W3Schools
Online Web Tutorials</A>
</DL><p>
// php file ----------------------------------------------------------------------------
$file = file_get_contents("bookmarks.html"); // open & reads the
bookmarks document
preg_match_all("/\">*(.*?)<\/*h3>\s*<dl><p>\s*.*<dt><a\s*href=*\"(.*?)\".*\">(. *?)<\/*a>/i",
$file, $links); // picking out (1-the folder names =$links[1], 2-the
links =$links[2], 3-the linktitles =$links[3]
print "<pre>";
print_r($links[2]); // prints all the 5 links
print "</pre>";
?>
// -------------------------------------------------------------------------------------
I hope somebody have some smart ideas about this. Already thanks in
advance!
AlphaC