Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. That's how I'd do it, that's what usort is for.
  2. You could do it in an editor like tinyMCE, by loading the content into it instead of just the page. Otherwise, I don't see how you'd do it. You'd need to use javascript and php for sure, but I don't know what you'd do.
  3. You would use the $this keyword, yes. <?php Class A{ var $foo; function bar(){ $this->foo = 'Hi'; } function myFunc(){ $this->foo = 'Hello'; } ?>
  4. Uhm, if you want to write a program in PERL, you might wanna check what forum you're in For PHP, you could use CURL. What do you mean by indexes URLs?
  5. I don't know WML, sorry. At least it's working better
  6. If you search on php.net you'd find: http://php.net/array_search And then by reading the docs you would find: http://www.php.net/manual/en/function.array-keys.php Try working with those.
  7. cor doesn't return a value, it echos it. Change echo to return.
  8. Go through the string char by char, and use http://php.net/ctype-upper on the individual letters. Create a new string as you go along. If it's uppercase, add a space after it when you add the letter to your new string. Also, you could store the original string as Wind-In-The-Willows and just use str_replace. If you're doing it for URLs or something, it's best to use a hyphen in place of your spaces.
  9. Your reply makes no sense. If you're working in Wordpress this might do better in third-party scripts. if register_sidebar is a wordpress function.
  10. I think you will have to use PHP to generate the wml, so it will have a .php extension. That is the only way to run php code, with a .php . You would generate the type of the content using: <?php header("Content-type: text/css"); ?> Only I don't know what you'd put for wml files. I bet you can find a list somewhere though.
  11. You're not printing out those strings anywhere, just setting the variables. Show us more of the relevant code, we don't know what register_sidebar does.
  12. Also, pick up a book on PHP that will explain the basics of how this server-side language actually works. Tutorials you find online assume you already know something about programming and how to use php.
  13. It displays for me too, the version of firefox shouldn't be that big a deal. Did you accidentally block it in IE? Does it show in IE, Opera or Safari? The only way I have ever been able to do it is with appending the timestamp to the end.
  14. No problem. And always assume your users are both complete idiots, and amazing hackers. Check EVERYTHING for ANY possible errors and test it out.
  15. Check out CURL and regular expressions
  16. use str_replace to replace any ,0 with an empty string '' Then check if the very first character of the string is 0 and if so remove it and the subsequent comma. Or you could loop through the array before you implode it and unset any values == 0
  17. I use a rather complicated resize function, but I've simplified it here, this might help you with creating a file instead of storing in DB: It will save it as a jpg always, but I bet you can figure out how to change that. <?php if(isset($_FILES['file'])){ $ext = explode('.', $_FILES[$this->id]['name']); $ext = $ext[count($ext)-1]; $newName = 'my file new name.'.$ext; $newLoc = 'new/file/location'; $targetPath = $newLoc.$newName; if(move_uploaded_file($_FILES['file']['tmp_name'], $targetPath)) { $this->savedFileLoc = $f; if($ext == 'jpg'){ $ext = 'jpeg'; } $func = 'imagecreatefrom'.$ext; $photo = $newLoc.$newName; list($width_orig, $height_orig) = getimagesize($photo); $ratio_orig = $width_orig/$height_orig; $maxW = 200; $maxH = 150; if($maxW/$maxH > $ratio_orig){ $newW = $maxW*$ratio_orig; $newH = $maxH; }else{ $newH = $maxH/$ratio_orig; $newW = $maxW; } if($newH <= $height_orig && $newW <= $width_orig){ $image_p = imagecreatetruecolor($newW, $newH); $image = $func($photo); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $newW, $newH, $width_orig, $height_orig); if(imagejpeg($image_p, $path.$newName.'.jpg', 100)){ $file = $newName.'.jpg'; } } } } ?> (I didn't check it for errors, sorry)
  18. Did you try removing the ' ' around your sql query? It looks to me like you're just setting it to that string, instead of the result of that query.
  19. If you want someone to write it for you specifically, you'll probably have to pay them. People are here to help, not do it for you. You could google CURL and find a ton of good tutorials so you can write it, or you can post in freelancing
  20. I just posted this on another topic, it's a good tutorial for html forms and php. http://www.tizag.com/phpT/forms.php BTW, The very simple code papaface posted won't allow for any error checking and printing of such error messages, if you only show the form if it's not been posted.
×
×
  • 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.