verwenden Ich entwickle Neu Joomla-Komponente. Ich möchte wissen, wie Sie die Zeitauswahl in My Joomla Component hinzufügen.Wie Time Picker in Joomla compoent
0
A
Antwort
1
Sie können Ihre eigenen Feldtypen in Joomla erstellen. Dieses Beispiel ist für ein Modul, aber das gleiche Verfahren arbeitet mit Komponenten: diese Datei erstellen: /modules/mod_yourmodule/fields/datetime.php
<?php // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); // Add CSS and JS JHtml::stylesheet('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css'); JHtml::stylesheet('http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css');JHtml::script('http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js'); jimport('joomla.form.formfield'); class JFormFieldDateTime extends JFormField {
protected $type = 'DateTime';
public function getInput() {
return '<div class="well">'.
'<div id="datetimepicker2" class="input-append">'.
'<input data-format="MM/dd/yyyy HH:mm:ss PP" type="text"></input>'.
'<span class="add-on">'.
'<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>'.
'</span>'.
'</div>'.
'</div>'.
'<script type="text/javascript">'.
'jQuery(function() {'.
'jQuery("#datetimepicker2").datetimepicker({'.
'language: "en",'.
'pick12HourFormat: true'.
'});'.
'});'.
'</script>';
} }
1
Zeigt ein Kalendersteuerfeld:
calendar($value, $name, $id, $format= '%Y-%m-%d', $attribs=null)
$value=>The date value,$name=>The name of the text field,$id=>The id of the text field,$format=>'%Y-%m-%d' The date format,$attribs=>null Additional html attributes,$value=>The date value,$name=> The name of the text field,$id=> The id of the text field,$format=>'%Y-%m-%d' The date format,$attribs=>null Additional html attributes
Warum Import ** ** eine andere Instanz Bootstrap? Sie können Ihren Code auch korrekt anzeigen lassen, da die Hälfte davon auskommentiert ist. – Lodder