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>ph p</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>progra mming</H3>"
folder (2 items).
<TITLE>Bookmark s</TITLE>
<H1>Bookmarks </H1>
<DT><H3>php</H3>
<DL><p>
<DT><A HREF="http://www.w3schools.c om/php/default.asp"
ID="rdf:#$ScZXl 3">PHP Tutorial</A>
<DT><A HREF="http://www.php.net/" ID="rdf:#$TcZXl 3">PHP: Hypertext
Preprocessor</A>
<DT><A HREF="http://www.phpdig.net/" ID="rdf:#$TfZXl 3">PhpDig.ne t -
Web Spider and Search Engine</A>
</DL><p>
<DT><H3>program ming</H3>
<DL><p>
<DT><A HREF="http://www.codebrain.c om/java/gutenberg/index.html"
ID="rdf:#$qI7Ab 2">GUTENBERG APPLET</A>
<DT><A HREF="http://www.w3schools.c om/" ID="rdf:#$UcZXl 3">W3Schools
Online Web Tutorials</A>
</DL><p>
// php file ----------------------------------------------------------------------------
$file = file_get_conten ts("bookmarks.h tml"); // open & reads the
bookmarks document
preg_match_all( "/\">*(.*?)<\/*h3>\s*<dl><p>\ s*.*<dt><a\s*hr ef=*\"(.*?)\".* \">(.*?)<\/*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
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>ph p</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>progra mming</H3>"
folder (2 items).
<TITLE>Bookmark s</TITLE>
<H1>Bookmarks </H1>
<DT><H3>php</H3>
<DL><p>
<DT><A HREF="http://www.w3schools.c om/php/default.asp"
ID="rdf:#$ScZXl 3">PHP Tutorial</A>
<DT><A HREF="http://www.php.net/" ID="rdf:#$TcZXl 3">PHP: Hypertext
Preprocessor</A>
<DT><A HREF="http://www.phpdig.net/" ID="rdf:#$TfZXl 3">PhpDig.ne t -
Web Spider and Search Engine</A>
</DL><p>
<DT><H3>program ming</H3>
<DL><p>
<DT><A HREF="http://www.codebrain.c om/java/gutenberg/index.html"
ID="rdf:#$qI7Ab 2">GUTENBERG APPLET</A>
<DT><A HREF="http://www.w3schools.c om/" ID="rdf:#$UcZXl 3">W3Schools
Online Web Tutorials</A>
</DL><p>
// php file ----------------------------------------------------------------------------
$file = file_get_conten ts("bookmarks.h tml"); // open & reads the
bookmarks document
preg_match_all( "/\">*(.*?)<\/*h3>\s*<dl><p>\ s*.*<dt><a\s*hr ef=*\"(.*?)\".* \">(.*?)<\/*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
Comment