i have this PHP variable set in joomla 2.5 template file
$datestart = date('Y-m-d g:i', strtotime("+1 week"));
$dateend = date('Y-m-d g:i', strtotime("+30 days"));
and when i echo this
<?php echo json_encode($datestart); ?>
inside a php page it works. I'm trying to include this variable inside a jQuery function of the RS Form component
$formLayout .= "\n".'<script type="text/javascript" src="'.JURI::root(true).'/components/com_rsform/assets/calbs.js"></script>'."\n";
in the .js file i have
jQuery(function() {
jQuery("#datetimepicker").datetimepicker({
format: "dd MM yyyy - HH:ii P",
showMeridian: true,
autoclose: true,
startDate: <?php echo json_encode($datestart); ?>,
endDate: <?php echo json_encode($dateend); ?>,
minuteStep: 15,
pickerPosition: "bottom-left"
});
});
But it's not working and shows syntax error for the php echo line. How can i solve this ?