| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| readme.txt | 2010-08-29 | 3.2 kB | |
| jQuery.1.1.class.php | 2010-08-29 | 5.2 kB | |
| test.php | 2010-08-28 | 199 Bytes | |
| jQuery.class.php | 2010-08-28 | 2.3 kB | |
| Totals: 4 Items | 10.8 kB | 0 |
Good for beginners in PHP :)
How will it help me in Coding PHP?
> Suppose, you're coding a script which fetches data from a remote page. You have to fetch data. You can use this.
How to use this code?
> If you have knowledge of jQuery, then coding PHP is not anymore a hassle! Use jQuery kinda syntax :)
Any example code?
> It is on the Page only :)
Still here it is:
--------------------------------------------------------------------------------------
<?php
include("jQuery.class.php");
$file = file_get_contents("http://farmvilleproguide.icantbelievethis.info/");
header("Content-type:text/plain");
$arr = jquery("span[id]", $file);
print_r($arr);
?>
--------------------------------------------------------------------------------------
Link?
> https://sourceforge.net/downloads/jquery-php/
The basic Syntax? I don't know jQuery, actually.
> No worries! So, here it is:
For ID:
--------------------------------------------------------------------------------------
jquery("#ID_of_Tag_here[The_attribute_here]", $the_html_document_code);
--------------------------------------------------------------------------------------
Like, #submit[value] It will return the Value attribute of the Tag whose ID is "submit"
For Class:
--------------------------------------------------------------------------------------
jquery(".Class_of_Tag_here[The_attribute_here]", $the_html_document_code);
--------------------------------------------------------------------------------------
It will return the attributes in an Array.
For only Tags:
--------------------------------------------------------------------------------------
jquery("Tag_here[The_attribute_here]", $the_html_document_code);
--------------------------------------------------------------------------------------
It will return the attributes in an Array.
Any other additional features?
> Added more selectors.
What are selectors?
> Selectors will help you to fetch/get data in an easier manner.
What all have you added?
> I've added these:
--------------------------------------------------------------------------------------
:first - Get the first element that you selected.
:last - Get the last element that you selected.
:n - Here n is the index number that you want to get.
* - Get all the elements.
--------------------------------------------------------------------------------------
Any example code?
> This will get the Value Attribute of the 4th Input Element. Remember, counting starts from 0 here :P
-------------------------------------------
jquery("input:3[value]", $doc);
-------------------------------------------
Same goes for classes:
-------------------------------------------
jquery(".head:last[id]", $doc);
-------------------------------------------
This will get the id of the last element whose class is "head".
What will the * selector do?
> Well, it will give all the elements and their attributes in an array :)
Example:
-------------------------------------------
http://pastebin.com/0xXDDfnv
-------------------------------------------
Link: https://sourceforge.net/projects/jquery-php/files/jQuery.1.1.class.php/download
Might be having bugs. Please, report here :)
-Yash