Results 1 to 7 of 7
-
12th Apr 2011, 08:26 PM #1OPMemberWebsite's:
maxneeds.infojquery advanced sorting question
Hi !
I am having problem doing this in php thats why my last hope is jquery.
Ok here's the problem :
I need to sort everything based on numbers.
I am amateur in Jquery so please give some script.
CURRENT:
Code:<div id=incase> <span class=top_ten_fav id=0>something(has numbers) (<span class=0>2</span>).</span><br /> <span class=top_ten_fav id=1>something(has numbers) (<span class=1>1</span>).</span><br /> <span class=top_ten_fav id=2>something(has numbers) (<span class=2>1</span>).</span><br /> <span class=top_ten_fav id=3>something(has numbers) (<span class=3>1</span>).</span><br /> <span class=top_ten_fav id=4>something(has numbers) (<span class=4>1</span>).</span><br /> <span class=top_ten_fav id=5>something(has numbers) (<span class=5>1</span>).</span><br /> <span class=top_ten_fav id=6>something(has numbers) (<span class=6>1</span>).</span><br /> <span class=top_ten_fav id=7>something(has numbers) (<span class=7>1</span>).</span><br /> <span class=top_ten_fav id=8>something(has numbers) (<span class=8>1</span>).</span><br /> <span class=top_ten_fav id=9>something(has numbers) (<span class=9>14</span>).</span><br /> <span class=top_ten_fav id=10>something(has numbers) (<span class=10>28</span>).</span><br /> <span class=top_ten_fav id=11>something(has numbers) (<span class=11>15</span>).</span><br /> <span class=top_ten_fav id=12>something(has numbers) (<span class=12>1</span>).</span><br /></div> AND MORE...
Code:something(has numbers) (28). something(has numbers) (15). something(has numbers) (14). something(has numbers) (2). something(has numbers) (1). something(has numbers) (1). something(has numbers) (1). something(has numbers) (1). something(has numbers) (1). something(has numbers) (1).
Pls help that's damn important (i lost 12 hours on pc about this)Porsche_maniak Reviewed by Porsche_maniak on . jquery advanced sorting question Hi ! I am having problem doing this in php thats why my last hope is jquery. Ok here's the problem : I need to sort everything based on numbers. I am amateur in Jquery so please give some script. CURRENT: <div id=incase> <span class=top_ten_fav id=0>something(has numbers) (<span class=0>2</span>).</span><br /> Rating: 5
-
12th Apr 2011, 09:27 PM #2Respected Member
If you want it done in php is the something a constant or each something is different?
-
13th Apr 2011, 10:33 AM #3OPMemberWebsite's:
maxneeds.infoeach something is different
here's the php code !
PHP Code:
function directoryToArray($directory, $recursive) {
$array_items = array();
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($directory. "/" . $file)) {
if($recursive) {
$array_items = array_merge($array_items, directoryToArray($directory. "/" . $file, $recursive));
}
$file = $directory . "/" . $file;
$array_items[] = preg_replace("/\/\//si", "/", $file);
} else {
$file = $directory . "/" . $file;
$array_items[] = preg_replace("/\/\//si", "/", $file);
}
}
}
closedir($handle);
}
return $array_items;
}
$filenamesdl=directoryToArray('fav',true);
$filenames = array();
while (list ($key, $val) = each ($filenamesdl)) {
if(strstr($val,".txt")){
$filenames[]=basename($val); }
}
$filenames=array_count_values($filenames);
$total = array();
while (list ($key2, $val2) = each ($filenames)) {
$total[]=$val2;
}
$i=0;
foreach ($filenamesdl as $dl) {
$filenamesdl=@file_get_contents($dl);
if(!empty($filenamesdl) && !empty($total[$i])){
$entry_arrayz[ 'entry' ] .= '<span class=top_ten_fav id='.$i.'>'.$filenamesdl . '(<span class='.$i.'>'.$total[$i].'</span>).</span><br />';
$i++;
} }
$entry_arrayz[ 'entry' ]="<div id=incase>".$entry_arrayz[ 'entry' ].'</div>';
So i must sort the downloaded txt with the array_count_values.
-
13th Apr 2011, 03:59 PM #4(╯?□?)╯︵ ┻━┻Website's:
Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.comhttp://jsfiddle.net/NFfw4/
this seems to work, i expected it to duplicate the divs when running the each() loop but it didn't, which is good lol.Projects:
WCDDL - The Professional DDL Script
Top Secret Project: In Development - ZOMG
ImgTrack - Never Have Dead Images Again!
-
13th Apr 2011, 07:03 PM #5OPMemberWebsite's:
maxneeds.info@JmZ
woow man ! You just discovered new jquery function which i bet many people will use ! It is equal to natsort in php ! So many tnx ! I wish i had a paypal to pay you a beer
Btw how to limit the results to ten ?
-
13th Apr 2011, 07:48 PM #6(╯?□?)╯︵ ┻━┻Website's:
Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.comhttp://jsfiddle.net/NFfw4/4/
Like this.Projects:
WCDDL - The Professional DDL Script
Top Secret Project: In Development - ZOMG
ImgTrack - Never Have Dead Images Again!
-
13th Apr 2011, 08:04 PM #7OPMemberWebsite's:
maxneeds.info
Finally. I feel bit relaxed cuz the only thing left to do is to make delete/edit functions to my custom forum
JQuery is so powerful and it has future !
TNX !
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Sorting links but with something more..
By stefan-te in forum Technical Help Desk SupportReplies: 4Last Post: 1st Aug 2012, 10:11 PM -
JQuery and RegExr Help :|
By Porsche_maniak in forum Web Development AreaReplies: 4Last Post: 1st Jun 2012, 12:26 AM -
JQuery help
By xElliex in forum Web Development AreaReplies: 5Last Post: 25th Aug 2011, 10:38 PM -
Help sorting files from directory by latest uploaded
By Jgutz in forum Webmaster DiscussionReplies: 1Last Post: 29th Mar 2011, 07:53 PM -
Default Sorting Categories?
By Golden Falcon in forum phpBBReplies: 0Last Post: 24th Sep 2008, 11:24 PM
themaRegister - register to forums...
Version 3.54 released. Open older version (or...