Yii 1.1: locationpicker

Enable to pick location in form
4 followers

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>

Screenshot

http://s21.postimg.org/xhy500y4n/Screen_Shot_2014_03_24_at_3_05_57_PM.png

Be the first person to leave a comment

Please to leave your comment.

Create extension