Thursday, November 27, 2014

Yii Gridview CButton style

Standard




This  code shows about how to add a custom button with your own icon for your CGridView of Yii framework.“view”, “update”, “delete” button and it have corresponding actions. We can change it using CButtonColumn properties.




 widget('zii.widgets.grid.CGridView', array(
                'id'=>'modelname-grid',
                'dataProvider'=>$model->search(),
                'filter'=>$model,
                'columns'=>array(
          'rowname1',
  'rowname2',  
                        array(
                                'class'=>'CButtonColumn',
                                'template'=>'{view}{update}{delete}',
                            'deleteButtonImageUrl' => Yii::app()->theme->baseUrl .'/images/'.'close-button.png',
                            'deleteButtonOptions'=>array(
                                    'class'=>'delete_class',
                                    'id'=>'delete_id',
                                    ),
                            'updateButtonImageUrl' => Yii::app()->theme->baseUrl .'/images/'.'edit-button.png',
                            'updateButtonOptions'=>array(
                                    'class'=>'update_class',
                                    'id'=>'update_id',
                                    ),
                            'viewButtonImageUrl' => Yii::app()->theme->baseUrl .'/images/'.'view-button.png',
                            'viewButtonOptions'=>array(
                                    'class'=>'view_class',
                                    'id'=>'view_id',
                                    ),

                        ),
                ),
        )); ?>


 

if you want add this in YII framework follow this

open \CButtonColumn.php

..\yii\framework\zii\widgets\grid\CButtonColumn.php

defult code[line 215] function initDefaultButtons()

 


protected function initDefaultButtons()
 {
  if($this->viewButtonLabel===null)
   $this->viewButtonLabel=Yii::t('zii','View');
  if($this->updateButtonLabel===null)
   $this->updateButtonLabel=Yii::t('zii','Update');
  if($this->deleteButtonLabel===null)
   $this->deleteButtonLabel=Yii::t('zii','Delete');
  if($this->viewButtonImageUrl===null)
   $this->viewButtonImageUrl=$this->grid->baseScriptUrl.'/view.png';
  if($this->updateButtonImageUrl===null)
   $this->updateButtonImageUrl=$this->grid->baseScriptUrl.'/update.png';
  if($this->deleteButtonImageUrl===null)
   $this->deleteButtonImageUrl=$this->grid->baseScriptUrl.'/delete.png';
   
   
}   


 


update code function initDefaultButtons()

 


protected function initDefaultButtons()
 {
  if($this->viewButtonLabel===null)
   $this->viewButtonLabel=Yii::t('zii','View');
  if($this->updateButtonLabel===null)
   $this->updateButtonLabel=Yii::t('zii','Update');
  if($this->deleteButtonLabel===null)
   $this->deleteButtonLabel=Yii::t('zii','Delete');
  if($this->viewButtonImageUrl===null)
   $this->viewButtonImageUrl=Yii::app()->theme->baseUrl .'/images/'.'view-button.png';                
  if($this->updateButtonImageUrl===null)
   $this->updateButtonImageUrl=Yii::app()->theme->baseUrl .'/images/'.'edit-button.png';
  if($this->deleteButtonImageUrl===null)
   $this->deleteButtonImageUrl=Yii::app()->theme->baseUrl .'/images/'.'close-button.png';
   
   
}   



Sharp AQUOS Android Smartphone

Standard


Sharp Corporation collaborated with frog's team of designers and technologists to create “Feel UX”, a new Android smartphone experience that is easy to use, highly personalized, and visually stunning.










STUNNING 3D REALISM ON SCREENThe AQUOS Phone's parallax barrier system—which imitates the parallax difference between our right and left eye—enables the display of vivid three-dimensional HD images without the need for glasses. The phone recognises if content is 2D or 3D at playback, and adjusts accordingly. You can even convert 2D images into 3D, and vice versa, simply by switching the parallax barrier on or off.


Experience a new level of brilliance with Sharp's 4.2-inch LCD and ProPix image processor—technology derived from our line of AQUOS TVs. Boasting 540 x 960p qHD resolution—a quarter that of full 1920 x 1080p HD—the wide screen gives greater dynamic impact to movies and gameplay.
You'll no longer need to zoom in when browsing the internet, with the LCD's outstanding resolution making small text easier to read.




Software features
Some of the Aquos Crystal's unique software features include a gesture motion called "Clip Now." In addition to holding the bottom volume key and power button to take a screenshot, users can swipe the top edge of the display and save screenshots into a Clip Now image folder.














Get Country of IP Address with PHP

Standard





I'm trying to put together a PHP script that I can query from any web browser and it returns the Country of the IP address that accessed the PHP script


There are various web APIs that will do this for you. Here's an example using http://ipinfo.io:


          $ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}"));
echo $details;

  








 Here's an example using http://www.geoplugin.net/json.gp





$ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip={$ip}"));
echo $details;

      







Wednesday, November 26, 2014

YII Add Loading IMAGE on ajex

Standard



beginWidget('CActiveForm', array(
                                        'id'=>'listings-getdata_Ajax',                                    
                                        'enableAjaxValidation'=>FALSE,
                                )); ?>
             
                   params['Radius'],
                             array(
                               'ajax'=>array(
                                 'type'=>'POST',
                                  'url'=>CController::createUrl('listings/getdata_Ajax'),                            
                                    'update'=>'#getdata',
                                   'data' => array(
                                        'Getdata[radius]'=>'js:this.value',
                                        'Getdata[city]'=>$model->PhysicalCity,
                                             )
                                     ),
                                    'class'=>'form-control input-sm',
                                     'empty'=>'Select Province',
                                    'required'=>TRUE,
                                     )
                                    );
                        ?>
                        clientScript->registerScript('loaderScript', '
                             $("#loader")
                             .hide()
                             .ajaxStart(function() {
                                 $(this).show();
                             })
                             .ajaxStop(function() {
                                 $(this).hide();
                             });', CClientScript::POS_END);
                         ?>

                    theme->baseUrl.'/images/loader.gif', '', array('id' => 'loader', 'style' => ''));?>
             


 public function actionGetdata_Ajax()
             
 {
      echo 'hello';
        }
             

      

create div stick to top when scrolled

Standard
There are times when you would want to display a DIV bar at the top of the page when your scrolls on the page top or down  and it should go back to its original position when the user scrolls back up.
jQuery code:

/ executed when the viewr scrolls the page.
$(window).scroll(function(e) {
    // Get the position of the location where the scroller starts.
    var scroller_anchor = $(".scroller_anchor").offset().top;
     
    // Check if the user has scrolled and the current position is after the scroller start location and if its not already fixed at the top
    if ($(this).scrollTop() >= scroller_anchor && $('.scroller').css('position') != 'fixed')
    {    // Change the CSS of the scroller to hilight it and fix it at the top of the screen.
        $('.scroller').css({
            'background': '#CCC',
            'border': '1px solid #000',
            'position': 'fixed',
            'top': '0px'
        });
        // Changing the height of the scroller anchor to that of scroller so that there is no change in the overall height of the page.
        $('.scroller_anchor').css('height', '50px');
    }
    else if ($(this).scrollTop() < scroller_anchor && $('.scroller').css('position') != 'relative')
    {    // If the user has scrolled back to the location above the scroller anchor place it back into the content.
         
        // Change the height of the scroller anchor to 0 and now we will be adding the scroller back to the content.
        $('.scroller_anchor').css('height', '0px');
         
        // Change the CSS and put it back to its original position.
        $('.scroller').css({
            'background': '#FFF',
            'border': '1px solid #CCC',
            'position': 'relative'
        });
    }
});

             

      
HTML Code:
What if drugs were legal? Could you imagine what it would do to our society? Well according to John E. LeMoult, a lawyer with twenty years of experience on the subject, feels we should at least consider it. I would like to comment on his article "Legalize Drugs" in the June 15, 1984, issue of the New York Times. I disagree with LeMoult's idea of legalizing drugs to cut the cost of crime.
This is the scrollable bar
What if drugs were legal? Could you imagine what it would do to our society? Well according to John E. LeMoult, a lawyer with twenty years of experience on the subject, feels we should at least consider it. I would like to comment on his article "Legalize Drugs" in the June 15, 1984, issue of the New York Times. I disagree with LeMoult's idea of legalizing drugs to cut the cost of crime.
CSSCode:

.container{font-size:14px; margin:0 auto; width:960px}
.test_content{margin:10px 0;}
.scroller_anchor{height:0px; margin:0; padding:0;}

.scroller{background:#FFF; border:1px solid #CCC; margin:0 0 10px; z-index:100; height:50px; font-size:18px; font-weight:bold; text-align:center; width:960px;}

      

website's content on the Twitter wall Yii

Standard



Add buttons to your website to help your visitors share content and connect on Twitter.

 

		
	
      

website's content on the faebook wall Yii

Standard





post my website's content on the faebook wall. who want to share it.

<pre class="java" name="code"><div id="fb-root">
</div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-share-button" data-href="&lt;?php echo Yii::app()-&gt;theme-&gt;baseUrl;?&gt;/index.php/listings/&lt;?php echo $model-&gt;ListingId; ?&gt;" data-type="button_count" data-width="200">
</div>
&lt;!--<div class="fb-share-button" data-href="http://channasmcs.blogspot.com/2014/09/onclick-selected-value-in-input-box.html" data-type="button_count" data-width="200">
</div>
<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-type="box_count">
</div>
</pre>


Sunday, November 16, 2014

GRID & LIST Switch by Using Bootstrap

Standard




HTML Code:
Category Title

Product title

Product description... Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

$21.000

Product title

Product description... Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

$21.000

Product title

Product description... Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

$21.000

Product title

Product description... Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

$21.000

Product title

Product description... Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

$21.000

Product title

Product description... Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

$21.000


CSS Code:

      

JQ Code:

      

                                                                              GRID




LIST