Jump to content

capnH00K

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

capnH00K's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay, man i can't get this to work... ! Can you just tell me exacly what to type on the the " // everything from here is brought back from echo in php" line. And what to type in the html/php part to make it resive the php variable... function processNav() { // everything from here is brought back from echo in php $('mydiv').innerHTML = req.responseText; } Thanks
  2. i'm trying to make $dir = $link ... when the script is activated..
  3. Basicly i have 2 variables - $dir - $link $dir has a default set - so that it 'opens' a folder (runs through it and list everything inside it - like a folder in windows)... Inside this folder, there can be other folders - so when there's a folder inside the default $dir .. i'm creating a link which should then change the default $dir to the new one - so you kinda "opens" a new dir... it just has to work as the exploded in windows... If you press a folder you open that ... Does that make sence?
  4. ah i see... but The ID is the users id in the database.. So another id would mean that you are acessing another persons uploaded stuff :b
  5. But why? I mean, the dir has no id? I'm kinda confused? It it okay to ask if you have an messenger acc so I can ask you short questions there faster? :b
  6. What do i need the $theid (pars) for? All i need to do is actually to change a php variable from the click of a link...?
  7. Thanks for the note mate! Mind if I post here if I need an extra hand again ?
  8. AWESOME MATE, THANKS A TON! :D I'll see if i can put it together later tonight!
  9. Php code <?php $num_music=0; $dir = "uploaded/".$id."/music"; //#######THIS IS WHAT NEEDS TO BE CHANGED - SO YOU CAN JUMP BETWEEN DIR'S $files = scandir($dir); ?> <table width="100%" class="fcontent"> <tr class="fcontent_header"> <td width=" 23px"></td> <td width=" 23px"></td> <td><strong>Filename:</strong></td> <td><strong>Format:</strong></td> <td><strong>Filesize:</strong></td> </tr> <?php foreach($files as $ind_file)if($ind_file!="..") //runs througt the"selected" dir and lists everything in it, as a row in a colum. { if($ind_file!=".") //makes sure the "." is skipped { { $exploded = explode(".", $ind_file); //makes sure the "." isn't posted $bytes = filesize($dir."/".$ind_file); //bytes of file $megabytes=round($bytes/1000000, 2); //convers bytes to megabytes $link = $dir."/".$ind_file; //Complete link for the file or folder. $filename = str_replace(" ", "_", $exploded[0]); //replaces spaces in filename with "_"s $filename =str_replace("'","", "$filename"); //removes " ' "s from the filename $type = $exploded[1]; //filetype $folder = is_dir($link); // checks weather the link is a folder or a file ?> <tr class="special"> <td width="23px;"><input type="checkbox" name="<?php echo $filename ?>" /></td> <td width=" 23px"><?php if($folder=="TRUE"){echo "<img src='img/files/folder.png' width='23' height='23' ";}else{ echo "<img src='img/files/$type.png' width='23' height='23' ";}?></td> <td class=""></a><a href="<?php if($folder=='TRUE'){echo '#';}else{echo $link;}?>" <?php if($folder=="TRUE"){echo 'onClick="'; echo "doSomething('"; echo "$link";}?>')"/><?php echo "$filename";?> </td> <td class=""><?php echo "$type" ?></td> <td class=""><?php echo "$megabytes MB"; ?></td> </tr> <?php Java-script so far... (basicly the code you wrote) function AjaxObjectCreateGeneral() { var req; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari req = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } return req; } function doSomething(url) { req=AjaxObjectCreateGeneral(); if(req) { var url = url; alert(url); alert box.. $('TransMsgDisplay').innerHTML='<img src="../templates/admin/img/indicator.gif" align="center">'; req.onreadystatechange = processSomething; req.open("GET", url, true); req.send(); } } function processSomething() { if(req.readyState == 4) { if(req.status == 200) { //do something } } } Does this help you ? I'm sorry if it's a little messy
  10. Well that's kinda the problem... I'm still realy javascript/ajax noob So I don't know how to get java-scripts sent back to the php ... and i don't know how do refresh without actually refreshing... (you know what i mean?) $('yourdiv').innerHTML = $req.responseText - is this how to sent back variables to php ? Can you explain it this line of code a little, if it's not too much to ask
  11. Yea I know that, But lets say the PHP-var $dir = "uploaded/44/hello"; Then i want to run the script (which is executed when i press a link) - and after the script, i want the Php-var to be something else so something else is displayed... At the moment, I've been able to call an alert box with the text of what the Php-var needs to be... I just need someway to get the java-var url back into the php... and somehow "refresh" (without asctually refreshing) what is displayed...
  12. Okay what I have done now is adding what you have written and THANKS FOR THAT!! and to debug it, i've added an alert box which shows the dirreent paths to the folers, when i click them, So now i just have to pass the javasccript var url - back into the same php page, so that it kind of updates the folder... I guess this is where Ajax comes in handy?
  13. Let me see if i got this right.... function AjaxObjectCreateGeneral() { var req; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari req = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } return req; } //everything before is really basic, which is jst something that has to be there... function doSomething(url) { //here it will take the url which is in doSomething from HTML which can be changed (this would be the th elink to the folder)...? req=AjaxObjectCreateGeneral(); if(req) { var url = url; //sets the var URl to the URL? $('TransMsgDisplay').innerHTML='<img src="../templates/admin/img/indicator.gif" align="center">'; req.onreadystatechange = processSomething; req.open("GET", url, true); // req.send(); } } function processSomething() { if(req.readyState == 4) { if(req.status == 200) { // do something - Here i have to add some code to make it process the changed url back to the page? } } }
  14. This is my HTML code atm... and <tr class="special"> <td width="23px;"><input type="checkbox" name="hello" /></td> <td width=" 23px"><img src='img/files/folder.png' width='23' height='23' ></td> <td class=""><a href="uploaded/44/music/hello">hello</a></td> <td class=""></td> <td class="">0 MB</td> </tr> When i press the link which has a href to a folder, i want a javascript to take this href (or whatever) and update my $dir variable...
  15. Thanks for the answer!! But i'm still not really 100%, how do I grap the updated url from the ajax script, inside the html? :b i'm feeling kind of silly now lol
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.