Jump to content

dwest

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dwest's Achievements

Member

Member (2/5)

0

Reputation

  1. Solved this by using PHP function Shuffle() Further down in the plugin code is the following which takes each item in the array and does stuff to it: if (is_array($gallery_array)) { foreach ($gallery_array as $galleryID) { $out .= nggCreateAlbum($galleryID,$mode,$albumID); } } I changed it to: if (is_array($gallery_array)) { shuffle($gallery_array); foreach ($gallery_array as $galleryID) { $out .= nggCreateAlbum($galleryID,$mode,$albumID); } } Now the albums appear in a different order each time thsy are loaded. Thanks for the help anyway cmgmyr :-)
  2. Sorry! I got into the database and studied what is stored for sortorder and it is a string like this: a:8:{i:0;s:1:"7";i:1;s:1:"6";i:2;s:1:"1";i:3;s:1:"... I suppose that is an array? yes?
  3. Not working. Still seems to be putting them in the order specified in the admin settings.
  4. Thanks CMGMYR! Trying now. What is the significance of LIMIT? What is being limited?
  5. Hi, I have a WordPress photo gallery plugin which stores the order of the photo albums based on a sort order number assigned by me in the admin settings. I want to bypass this setting and display them in random order, different each time the page loads. The code in the plugin to get the sort order is $sortorder = $wpdb->get_var("SELECT sortorder FROM $wpdb->nggalbum WHERE id = '$albumID' "); if (!empty($sortorder)) { $gallery_array = unserialize($sortorder); } Is there an adjustment I can make to this that will give me a different order each time? I realize this is a hack to the plugin but I need to do it. I'm waiting on the plugin developer to formally add it as an option in the admin area of the plugin. Don't know when he'll get to it :-) Thanks!
  6. dwest

    eBay Time

    I just did this myself with the help of the fine folks here. First, eBay supplies time left as TimeLeft in their getsingleitem call. But it is indeed in the standardized format. This reformats it: $timeLeft = $res->Item->TimeLeft; $x =array(1 => 'Day', 'Hour', 'Minute', 'Second'); //escaped backslashes are for the Wordpress quicktag which removes backslashes upon insert. preg_match('/\\AP(?\\d*)D)?T(?\\d*)H)?(?\\d*)M)?(\\d*)S\\z/x',$timeLeft, $d); for ($i = 1; $i < 5; $i++){ $dare .= $d[$i] ? $d[$i].' '.$x[$i].($d[$i] > 1 ? 's ' : ' ') :''; } BTW I'm using the PHP kit from eBay which has a complete package of the API wrapped in PHP. Example in use here: www.smallartgems.com
  7. Hi, I have a piece of data supplied as a dollar amount: Example: $1.95 However, if the dollar amount happens to end in zero, then is is supplied without the zero. Example: $1.9 So, I need to test for the second digit after the decimal and if it isn't there, add a zero. How can I do that? Maybe regexp is applicable here?? Any help would be greatly appreciated. Thanks!
  8. Hi, I've got a function that is part of a code snippet I insert into blog posts in WordPress. Trouble is I may insert the snippet several times in the same post. PHP throws an error of course since the function was already declared in the previous insertion of the snippet. I would add the function to the centralized functions include file in WordPress but every time I upgrade WordPress it is overwritten. I'm not likely to remember that I've got function(s) in that file that I need six months from now if I upgrade ;-) So, can I wrap the function in some sort of "if this function is declared then ignore this" thing? If so, what's the test for whether it has been declared? Thanks!
  9. Disregard. Found this function: function reformat_date($date, $format){ // Function written by Marcus L. Griswold (vujsa) // Can be found at http://www.handyphp.com // Do not remove this header! $output = date($format, strtotime($date)); return $output; } And it works like a charm. Can be found here: http://www.handyphp.com/content/view/10/16/ Hope this helps someone
  10. From what I can tell, and I'm no expert, date() formats a time taken from the server. I need to reformat a string that is in one date format to another. Thanks though Any other assistance would be appreciated.
  11. Hi, I have a date and time supplied in this format: 2008-03-21 22:58:46 (the time is supplied as GMT) I want to display it in this format: March 21, 2008 at 3:58pm PDT (note Pacific Daylight Time) Any help would be greatly appreciated!
  12. Geeez! I wish I knew this stuff. I simply don't use it enough to warrant the education. I'm an artist getting my own site online so painting is what I do. I used to develop sites but never got into regexp or much scripting. The sites I built were pretty simple. All in WordPress. Thanks so much for your help on this. I can't imagine how folk like me would get along without your help and those like you. You are all much appreciated!
  13. HeHe...THAT is meant to replace the whole snippet, yes? Thanks a million for your input on this Since what I have now is this: $timeLeft = $res->Item->TimeLeft; $x =array(1 => 'Day', 'Hour', 'Minute'); //if using as quicktag in wordpress you must escape the backslashes because the quicktag insertion removes them. preg_match('/\\AP(\\d*)T(?\\d*)H)?(?\\d*)M)?(\\d*)S\\z/x',$timeLeft, $d); //preg_match('/\AP(\d*)T(?\d*)H)?(?\d*)M)?(\d*)S\z/x',$timeLeft, $d); //original code for ($i = 1; $i < 4; $i++){ $dare .= $d[$i] ? $d[$i].' '.$x[$i].($d[$i] > 1 ? 's ' : ' ') :''; } Could it not be tweaked to add the display of seconds? Is there something about this code that is faulty?
×
×
  • 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.