|
 Mike Gamble - 2009-10-12 01:08:51
This looks like it could be a really great class, but perhaps it's not quite ready. I'm having to use "@" to supress a lot of error messages (You might want to turn on error reporting in your .ini file). On encountering input tags without the final slash, it does a good job of putting the slash in, but it stripped out quotation marks and '=' signs as follows:
<input class="field" type text name empresa size 50 maxlength 100 value=""/>
With the following code I got the following error message:
require('HTMLPP.php');
$HTML=new HTMLPP;
$HTML->loadHTMLFile("http://www.mysite.com");
$HTML->stripComments();
$document=& $HTML->getDocument();//a reference
$element=& $document->getElementsBySelector("form");
echo $element->getInnerHTML();
Fatal error: Call to undefined method HTMLCollection::getInnerHTML() in C:\htdocs\wx.php on line 9
Thanks,
Mike
 Marco Marchiņ - 2009-10-12 08:08:51 - In reply to message 1 from Mike Gamble
Hi Mike thank you for writing. First of all i want to say that this is my first class so i'm not an expert about testing but if you help me to find errors it will be great because i want to do a good job with this.
Can you write the url or the source code or a part of the source code which gives you the error on the input field? I've tried a lot of times but i can't get the same error.
The second one is not an error. When you search by selector a collection is returned not an element so you can't use the getInnerHTML() function beacuse it's an element method.
You can use $element->elements[0]->getInnerHTML() to access the first element's inner HTML or you can use the each() function to iterate over every element in the collection.
Thank you again and please let me know the errors that you get so i can fix them.
 Marco Marchiņ - 2009-10-12 08:15:05 - In reply to message 1 from Mike Gamble
I forgot to ask you if you are using the new version 1.0.1 because with that release i've fixed a lot of bugs. Thank you.
 Mike Gamble - 2009-10-12 13:14:28 - In reply to message 2 from Marco Marchiņ
Thanks for your reply, Marco.
With the new version, I'm not getting the same error messages. I'm not sure what you changed, but the messages were undefined offsets from your your $match variable in the Parser class (line 117). I'm still getting that type of message from the Collection class (lines 638 -640).
The URL of the site is www.zecainfo.com/fale.php. It's doing that to all of the input tags and the textarea tag.
require('HTMLPP.php');
$HTML=new HTMLPP;
$HTML->loadHTMLFile("http://www.zecainfo.com/fale.php");
$HTML->stripComments();
$document=& $HTML->getDocument();
echo $HTML->render();
You're right -- my mistake. I need to take some more time to figure out what functions to use with which variables. Your documentation is great, but it's taking some time for me to digest it all.
Thanks,
Mike
 Marco Marchiņ - 2009-10-12 18:47:45 - In reply to message 4 from Mike Gamble
I want to ask you one more thing, can you write a piece of code? I don't know why but i can't access the site that you gave me so i can't do any test. If you can write some lines of code with some of those input tags it will be great and you will help me very much, because i've done a lot of tests but i can't get the same error.
Anyway thanks for the support I appreciate it very much.
 Mike Gamble - 2009-10-12 23:51:37 - In reply to message 5 from Marco Marchiņ
I stripped the page down to almost nothing:
require('HTMLPP.php');
$HTML=new HTMLPP;
$test = <<< EOAAA
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ZEC@INFO: Fale Conosco</title>
</head>
<body>
<form class = "zm" action = "/fale.php" method = "post">
Nome<input class="field" type = "text" name = "nome" size = "50" maxlength = "100" value =""/>
E-mail<input class="field" type = "text" name = "email" size = "50" maxlength = "100" value =""/>
<textarea class="field" name = "mensagem" cols = "50" rows = "5"></textarea>
<input type = "submit" name = "sub" value = "Enviar"/>
</form>
</body>
</html>
EOAAA;
$HTML->loadHTML($test);
$HTML->stripComments();
$document=& $HTML->getDocument();
echo $HTML->render();
Thanks,
Mike
 Marco Marchiņ - 2009-10-13 08:19:54 - In reply to message 6 from Mike Gamble
I finally fixed the input field bug. Thanks for your disponibility Mike, i've added a special thank to you in the changelog section :)
Please let me know if you find other bugs.
 Mike Gamble - 2009-10-13 12:17:35 - In reply to message 7 from Marco Marchiņ
Thanks Marco!
Great Class!
|