|
hi all,
i atlast found a function which did what i want :
function str_replace_once($search, $replace, $subject, &$offset = 0) {
if (is_array($search)) {
if (is_array($replace)) {
foreach ($search as $x => $value) $subject = str_replace_once($value, $replace[$x], $subject, $offset);
} else {
foreach ($search as $value) $subject = str_replace_once($value, $replace, $subject, $offset);
}
} else {
if (is_array($replace)) {
foreach ($replace as $value) $subject = str_replace_once($search, $value, $subject, $offset);
} else {
$pos = strpos($subject, $search, $offset);
if ($pos !== false) {
$offset = $pos+strlen($search);
$subject = substr($subject, 0, $pos) . $replace . substr($subject, $offset);
}
}
}
return $subject;
}
$sql="select TemplateName_VC, Header_Txt, Footer_Txt, Content_Txt from Templates_T where Template_ID='$Template_ID'";
$rs=$db->getRow($sql,DB_FETCHMODE_ASSOC);
$content=$rs['header_txt'].'<br>';
$content.=$rs['content_txt'].'<br>';
$content.=$rs['footer_txt'];
$Content_TX=explode("::date::",$content);
$Content = str_replace_once("::date::", $dispdate, $content);
$Content=str_replace_once("::time::", $hours, $Content);
print "<br><br>CONTENT = ".$Content."<br><br><br><br>";
////////////////////////////////////////////////////////////////////
but the last problem is i will have to merge hours[] and minutes[] array someting like below:
hours Array:
Array ( [0] => 11 [1] => 12 [2] => 13 [3] => 14 )
minutes[] Array:
Array ( [0] => 30 [1] => 30 [2] => 30 [3] => 30 )
now i want an array which will merge hours[] and time[] and give me an time[] array someting like below:
time[] Array:
Array ( [0] => 11:30 [1] => 12:30 [2] => 13:30 [3] => 14:30 )
how can i do it...
this will be the last step... then i will have to just do the below and the entire string will be the way i want:
$Content=str_replace_once("::time::", $time, $Content);
now i am on the tail end. how will i merge hours[] and minutes[] and get time[] array
Thanks
|