Thursday, 14 July 2011

Need to disable the right sidebar

<?php if ($this->countModules('top or right')) { ?>
<div id="rightColumn" class="column">
                  
                     <jdoc:include type="modules" name="top" style="rounded" />

                           
                        <jdoc:include type="modules" name="right" style="rounded" />
               </div>
<?php } ?>

Tuesday, 12 July 2011

Jquery Tab simple example

download latest jquery
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.tabify.js"></script>
<script type="text/javascript">
  $(document).ready(function () {
   $('#tabs').tabify();
  });
 </script>

jquery.tabify.js

(function(a){a.fn.extend({tabify:function(e){function c(b){hash=a(b).find("a").attr("href");return hash=hash.substring(0,hash.length-4)}function f(b){a(b).addClass("active");a(c(b)).show();a(b).siblings("li").each(function(){a(this).removeClass("active");a(c(this)).hide()})}return this.each(function(){function b(){location.hash&&a(d).find("a[href="+location.hash+"]").length>0&&f(a(d).find("a[href="+location.hash+"]").parent())}var d=this,g={ul:a(d)};a(this).find("li a").each(function(){a(this).attr("href", a(this).attr("href")+"-tab")});location.hash&&b();setInterval(b,100);a(this).find("li").each(function(){a(this).hasClass("active")?a(c(this)).show():a(c(this)).hide()});e&&e(g)})}})})(jQuery);


html
 <div id="main">
                    <ul id="tabs" class="tabs">
                    <li  class="active"><a href="#tab1">live! 24</a></li>
                    <li><a href="#tab2" class="second">Kategóriák</a></li>

                   <li><a href="#tab3" class="second">Kategóriák</a></li>
                   </ul>

<div id="tab1">
Tab1
</div>

<div id="tab2">
Tab 2
</div>

<div id="tab3">
Tab 3
</div>
 </div>






 css file

#main .tabs { padding: 0; clear: both; }
#main .tabs li { display: inline; }
#main .tabs li a {background: #BEB9B2;
    border-bottom: medium none;
    border-right: 1px solid #CCCCFF;
    color: #fff;
    float: left;
    font-weight: bold;
    margin-left: 3px;
    padding: 10px;
    position: relative;
    text-align: center;
    text-decoration: none;
    width: 100px;
    font-size:16px;
    height: 14px;
    line-height: 14px;
     }
#main .tabs li.active a {  text-decoration:none;
 background-color:#E60000; width: 100px;
 font-size:16px;
  color: #fff; }

Saturday, 9 July 2011

PHP Image width and height get

<?php

list($width$height$type$attr) = getimagesize("img/flag.jpg");
print $width;
print $height;
print $type ;
print $attr;
echo 
"<img src=\"img/flag.jpg\" $attr alt=\"getimagesize() example\" />";?>



.htaccess and from phpInfo I see that it's now using php5. Great!
AddHandler application/x-httpd-php5 .php 

AddHandler application/x-httpd-php5 .php
AddType application/x-httpd-php5 .php 

Thursday, 7 July 2011

Drupal: customize form label

I always enjoy Drupal Form API with the standard output, easy to use, and easy for extension. But sometime, due to special reason, you only want to display the form input itself, no wrapper div or label. In Drupal 7, it can be as simple as changing a boolean value, but for Drupal 6 it's a big trick. And here is the trick.
The main idea is all form element are run through theme_form_element, and this theme function adds label and wrapper to form output, so all we have to do is override this theme function to create an exception. Open your template.php in your theme and add the following code:

function themename_form_element($element, $value) {
  // This is also used in the installer, pre-database setup.
  $t = get_t();
 
  if (empty($element['#no_wrapper'])) {
      $output = '<div class="form-item"';
      if (!empty($element['#id'])) {
        $output .= ' id="'. $element['#id'] .'-wrapper"';
      }
      $output .= ">\n";
      $required = !empty($element['#required']) ? '<span class="form-required" title="'.  
$t('This field is required.') .'">*</span>' : '';
 
      if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
          $output .= ' <label for="'. $element['#id'] .'">'.  
$t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required))  
."</label>\n";
        }
        else {
          $output .= ' <label>'. $t('!title: !required', array('!title' => filter_xss_admin($title), 
'!required' => $required)) ."</label>\n";
        }
      }
 
      $output .= " $value\n";
 
      if (!empty($element['#description'])) {
        $output .= ' <div class="description">'. $element['#description'] ."</div>\n";
      }
 
      $output .= "</div>\n";
  }
  else {
    return $value;
  }
 
  return $output;
}
 
function _render_element(&$element) {
    $element['#no_wrapper'] = true;
    $result = drupal_render($element);
 
    return $result;
}

Source base installation of php, mysql and apache in ubuntu/ linux

Compile and Install a LAMP(Linux/Apache/MySQL/PHP) Server from Source In the last post, I described the method to install a LAMP ser...