Warning: explode() [function.explode]: Empty delimiter in /home/lovejon1/public_html/lovejonesboutique-toys.com/admin/includes/functions/extra_functions/easypopulate_functions.php on line 247
In the EP Functions file, let's look at the content between lines 225 and 273 -:
PHP Code:
function ep_datoriser($date_time) {
global $ep_date_format; // d-m-y etc..
global $ep_raw_time; // user's prefered time (eg for specials to start) if no time in upload
$raw_date_exist = preg_match("/^([0-2]0[0-9]{2}-[0-1][0-9]-[0-3][0-9])( [0-2][0-9]:[0-5][0-9]:[0-5][0-9]$)?/", $date_time);
if (!$raw_date_exist) {
// not raw... we can only assume it is an excel date..
// separate dates from times
$exist_time = preg_match("/^2?0?[0-9]?[0-9][\.\/-][0-3]?[0-9][\.\/-]2?0?[0-9]?[0-9] ([0-2]?[0-9]:[0-5][0-9]).*$/", $date_time, $excel_time); // no seconds..
$exist_date = preg_match("/^(2?0?[0-9]?[0-9][\.\/-][0-3]?[0-9][\.\/-]2?0?[0-9]?[0-9]).*$/", $date_time, $excel_date);
//echo $excel_time[1] . '<br >';
//echo $excel_date[1] . '<br ><br />';
// if (!zen_not_null($exist_date)) // we fail to get a date! error msg rqd, and/or substitute action??
// check for which of 3 possible date separators we have..
// this sucks, I know... but it works for now
if (zen_not_null(strpos($excel_date[1], '-'))) $separator = '-';
if (zen_not_null(strpos($excel_date[1], '.'))) $separator = '.';
if (zen_not_null(strpos($excel_date[1], '/'))) $separator = '/';
//echo 'separator is: ' . $separator . '<br />';
$format_bits = explode('-', $ep_date_format);
$date_bits = explode($separator, $excel_date[1]);
foreach ($format_bits as $key => $bit) {
$$bit = $date_bits[$key]; // $y = 05 or 2005, $m = 09 or 9, $d = 03 or 3 for eg. Can only work if d,m,y order from excel is same as config
$$bit = strlen($$bit) < 2 ? '0' . $$bit : $$bit; // 4 is now 04 for eg. - expand this as a rudimentary check - should never occur on $y var
$$bit = strlen($$bit) > 2 ? substr($$bit,-2, 2) : $$bit; // 2005 is now 05 - expand this as a rudimentary check - should only occur on $y var
//echo $$bit . '<br />';
// another rudimentary check could be for $m vals > 12 = error too!
}
// create default raw time... if user left space off, put it on..
if (substr($ep_raw_time,0, 1) != ' ') $ep_raw_time = ' ' . $ep_raw_time;
// is it really a raw time? if not, make it midnight..
$exist_raw_time = preg_match("/ [0-2][0-9]:[0-5][0-9]:[0-5][0-9]/", $ep_raw_time); // true if is raw time
$ep_raw_time = zen_not_null($exist_raw_time) ? $ep_raw_time : ' 00:00:00';
// if time supplied from excel, use it instead..
$ep_raw_time = zen_not_null($exist_time) ? ' ' . $excel_time[1] : $ep_raw_time;
//echo '<br />'.$ep_raw_time . '<br />';
$raw_date = '20' . $y . '-' . $m . '-' . $d . $ep_raw_time; // needs updating at the end of the century ;-)
//echo $raw_date . '<br /><br />';
} else {
// the date is raw, so return it
$raw_date = $date_time;
//echo $date . ' is raw...<br />';
}
return $raw_date;
You will see they manage the DATE functions.
So if you get the error (at the top) and the line referred to is between 225 and 273, then there is something wrong in the FORMAT of a date in your TXT file.
Typically, we use a SPREADSHEET program to manage our TXT files. While this makes life easier in most respects, spreadsheets have a habit (expecially MS Excel) of making radical assumptions about the content parsed into the sheet.
If it sees what look like a DATE, it will re-format that into the default date format.
If you have configured your EP to render DATE as YYYY : MM : DD , then it will write it as follows in a date field:
2008-02-01 08:16:01 (where 16:01 is the time).
Now you import this into Excel and it is likely to do the following:
1/2/2008
Then when you SAVE AS TXT, it probably retains this formatting - or could even go haywire and render it as something else...
So even though your sheet is now TAB DELIMITED TEXT, the format of the DATES is incompatible with EP.
If you start out with EP date formatting as
2008-02-01 08:16:01
You need to ensure it STAYS as
2008-02-01 08:16:01
Bookmarks