CLocationPicker is Yii extension to display latitude & longitude data with google map.
Requirement ¶
Gii or Giix
Usage ¶
- simply copy the extension to to protected/extensions/ folder
- your model must have latitude/lat and longitude/lng attribute
Before
<div class="form-group">
<?php echo $form->labelEx($model,'latitude', array('class'=>'col-sm-3 control-label')); ?>
<div class="col-sm-9">
<?php echo $form->textField($model, 'latitude',array('class'=>'form-control','maxlength'=>'20')); ?>
<?php echo $form->error($model,'latitude'); ?>
</div>
</div>
<div class="form-group">
<?php echo $form->labelEx($model,'longitude', array('class'=>'col-sm-3 control-label')); ?>
<div class="col-sm-9">
<?php echo $form->textField($model, 'longitude',array('class'=>'form-control','maxlength'=>'20')); ?>
<?php echo $form->error($model,'longitude'); ?>
</div>
</div>
After
<div class="form-group">
<label class="col-sm-3 control-label">Location</label>
<div class="col-sm-9">
<?php
$this->widget('ext.locationpicker.LocationPicker', array(
'model' => $model,
'latId' => "latitude", //can be replaced using your own attribute
'lonId' => "longitude", //can be replaced using your own attribute
));
?>
</div>
</div>
Good
I needed this
Good
I needed this
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.