Advertisement

This is about Me?

Do not read this

    Thanks To

    Related sites

    Community

    Syndication

    You can grab our news as an Atom feed.


    jQuery Twitter Marquee

    [28-Jul-2010]
    Twitter Marquee

    Twitter Marquee

    May be you see it everyday, a seamless-continuous  marquee in the Twitter homepage shows the current trending topic.  It's damn good with fading background and short description in a tooltips.

    If you like that marquee and want to put it in your website/blog, I have write such script using jQuery and CSS3 I just stolen a bunch of jQuery and CSS code from Twitter, clean it up and made to work standalone. :D

    All you need to do is edit the CSS (marquee width, background, text color etc) and image to fit to your need and drop it into your website or blog.

    It's nothing easier than to try it yourself and the following links will tell you everything.

    Incoming search terms:


    WordPress Plugin WP Sub Post

    [28-Jan-2010]

    WP Sub Post is a wordpress plugin that allow you to make your wordpress post has a parent or child post.

    Notes:

    • Child post is a real post that has a parent.
    • Child post only displayed on it's parent post page or when parent page is displayed.
    • Child post can not be viewed individually.
    • Child post has all possibility like a normal post, such as attachment, custom fields etc.

    Features:

    • Add/edit parent post directly from your post area.
    • No need to edit theme file.

    Limitations:

    • No setting page
    • I don't know about it's compatibility.

    Bugs:

    • Not compatible with my syntax highlight plugin :D

    Screenshot

    Plugin page:

    WP sub post

    New/Edit post page:

    Wp sub post

    View Single Post:

    Wp sub post

    RSS:

    Wp sub post


    Code:

    Here is the code of this plugins...  Hahaha.. little bit messy

    WP Sub Post

    WP Sub Post

    <?php</p>
    /*
    Plugin Name: WP Sub Post
    Plugin URI: http://wordpress.org/#
    Description: You can make a post is a child of another post.
    Author: Takien
    Version: 0.1 Alpha
    Author URI: http://takien.com
    */

    ////////////////////////////

    class Walker_PostDropdown extends Walker {

        var 
    $tree_type 'post';

        var 
    $db_fields = array ('parent' => 'post_parent''id' => 'ID');

        function 
    start_el(&$output$page$depth$args) {
            
    $pad str_repeat(' '$depth 3);

            
    $output .= "\tID\"";
            if ( 
    $page->ID == $args['selected'] )
                
    $output .= ' selected="selected"';
            
    $output .= '>';
            
    $title esc_html($page->post_title);
            
    $output .= "$pad$title";
            
    $output .= "\n";
        }
    }
    /////////////
    function &wp_get_posts($args '') {
        global 
    $wpdb;

        
    $defaults = array(
            
    'child_of' => 0'sort_order' => 'ASC',
            
    'sort_column' => 'post_title''hierarchical' => 1,
            
    'exclude' => '''include' => '',
            
    'meta_key' => '''meta_value' => '',
            
    'authors' => '''parent' => -1'exclude_tree' => '',
            
    'number' => '''offset' => 0
        
    );

        
    $r wp_parse_args$args$defaults );
        
    extract$rEXTR_SKIP );
        
    $number = (int) $number;
        
    $offset = (int) $offset;

        
    $cache = array();
        
    $key md5serializecompact(array_keys($defaults)) ) );
        if ( 
    $cache wp_cache_get'wp_get_posts''posts' ) ) {
            if ( 
    is_array($cache) && isset( $cache$key ] ) ) {
                
    $pages apply_filters('wp_get_posts'$cache$key ], $r );
                return 
    $pages;
            }
        }

        if ( !
    is_array($cache) )
            
    $cache = array();

        
    $inclusions '';
        if ( !empty(
    $include) ) {
            
    $child_of 0//ignore child_of, parent, exclude, meta_key, and meta_value params if using include
            
    $parent = -1;
            
    $exclude '';
            
    $meta_key '';
            
    $meta_value '';
            
    $hierarchical false;
            
    $incpages preg_split('/[\s,]+/',$include);
            if ( 
    count($incpages) ) {
                foreach ( 
    $incpages as $incpage ) {
                    if (empty(
    $inclusions))
                        
    $inclusions $wpdb->prepare(' AND ( ID = %d '$incpage);
                    else
                        
    $inclusions .= $wpdb->prepare(' OR ID = %d '$incpage);
                }
            }
        }
        if (!empty(
    $inclusions))
            
    $inclusions .= ')';

        
    $exclusions '';
        if ( !empty(
    $exclude) ) {
            
    $expages preg_split('/[\s,]+/',$exclude);
            if ( 
    count($expages) ) {
                foreach ( 
    $expages as $expage ) {
                    if (empty(
    $exclusions))
                        
    $exclusions $wpdb->prepare(' AND ( ID <> %d '$expage);
                    else
                        
    $exclusions .= $wpdb->prepare(' AND ID <> %d '$expage);
                }
            }
        }
        if (!empty(
    $exclusions))
            
    $exclusions .= ')';

        
    $author_query '';
        if (!empty(
    $authors)) {
            
    $post_authors preg_split('/[\s,]+/',$authors);

            if ( 
    count($post_authors) ) {
                foreach ( 
    $post_authors as $post_author ) {
                    
    //Do we have an author id or an author login?
                    
    if ( == intval($post_author) ) {
                        
    $post_author get_userdatabylogin($post_author);
                        if ( empty(
    $post_author) )
                            continue;
                        if ( empty(
    $post_author->ID) )
                            continue;
                        
    $post_author $post_author->ID;
                    }

                    if ( 
    '' == $author_query )
                        
    $author_query $wpdb->prepare(' post_author = %d '$post_author);
                    else
                        
    $author_query .= $wpdb->prepare(' OR post_author = %d '$post_author);
                }
                if ( 
    '' != $author_query )
                    
    $author_query " AND ($author_query)";
            }
        }

        
    $join '';
        
    $where "$exclusions $inclusions ";
        if ( ! empty( 
    $meta_key ) || ! empty( $meta_value ) ) {
            
    $join " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";

            
    // meta_key and meta_value might be slashed
            
    $meta_key stripslashes($meta_key);
            
    $meta_value stripslashes($meta_value);
            if ( ! empty( 
    $meta_key ) )
                
    $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s"$meta_key);
            if ( ! empty( 
    $meta_value ) )
                
    $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s"$meta_value);

        }

        if ( 
    $parent >= )
            
    $where .= $wpdb->prepare(' AND post_parent = %d '$parent);

        
    $query "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'post' AND post_status = 'publish') $where ";
        
    $query .= $author_query;
        
    $query .= " ORDER BY " $sort_column " " $sort_order ;

        if ( !empty(
    $number) )
            
    $query .= ' LIMIT ' $offset ',' $number;

        
    $pages $wpdb->get_results($query);

        if ( empty(
    $pages) ) {
            
    $pages apply_filters('wp_get_posts', array(), $r);
            return 
    $pages;
        }

        
    // Sanitize before caching so it'll only get done once
        
    $num_pages count($pages);
        for (
    $i 0$i $num_pages$i++) {
            
    $pages[$i] = sanitize_post($pages[$i], 'raw');
        }

        
    // Update cache.
        
    update_page_cache($pages);

        if ( 
    $child_of || $hierarchical )
            
    $pages = & get_page_children($child_of$pages);

        if ( !empty(
    $exclude_tree) ) {
            
    $exclude = (int) $exclude_tree;
            
    $children get_page_children($exclude$pages);
            
    $excludes = array();
            foreach ( 
    $children as $child )
                
    $excludes[] = $child->ID;
            
    $excludes[] = $exclude;
            
    $num_pages count($pages);
            for ( 
    $i 0$i $num_pages$i++ ) {
                if ( 
    in_array($pages[$i]->ID$excludes) )
                    unset(
    $pages[$i]);
            }
        }

        
    $cache$key ] = $pages;
        
    wp_cache_set'wp_get_posts'$cache'posts' );

        
    $pages apply_filters('wp_get_posts'$pages$r);

        return 
    $pages;
    }
    //////////////

    function walk_post_dropdown_tree() {
        
    $args func_get_args();
        if ( empty(
    $args[2]['walker']) ) // the user's options are the third parameter
            
    $walker = new Walker_PostDropdown;
        else
            
    $walker $args[2]['walker'];

        return 
    call_user_func_array(array(&$walker'walk'), $args);
    }

    function 
    wp_dropdown_posts($args '') {
        
    $defaults = array(
            
    'depth' => 0'child_of' => 0,
            
    'selected' => 0'echo' => 1,
            
    'name' => 'page_id''show_option_none' => '''show_option_no_change' => '',
            
    'option_none_value' => ''
        
    );

        
    $r wp_parse_args$args$defaults );
        
    extract$rEXTR_SKIP );

        
    $pages wp_get_posts($r);
        
    $output '';
        
    $name esc_attr($name);

        if ( ! empty(
    $pages) ) {
            
    $output "
    <select id=""$name\"" 
    name="\"$name\"">
    <
    option value="\"-1\"">$show_option_no_change</option>
    <
    option value="\""">$show_option_none</option>

    \n"
    ;
        }

        
    $output apply_filters('wp_dropdown_pages'$output);

        if ( 
    $echo )
            echo 
    $output;

        return 
    $output;
    }
    /////////////////////////////

    /* Use the admin_menu action to define the custom boxes */
    add_action('admin_menu''myplugin_add_custom_box');

    /* Use the save_post action to do something with the data entered */
    add_action('save_post''myplugin_save_postdata');

    /* Adds a custom section to the "advanced" Post and Page edit screens */
    function myplugin_add_custom_box() {

      if( 
    function_exists'add_meta_box' )) {
        
    add_meta_box'myplugin_sectionid'__'WP Sub Posts''myplugin_textdomain' ), 'myplugin_inner_custom_box''post''side','high' );
        
    //add_meta_box( $id,                  $title,                                      $callback,                  $page, $context, $priority );
        
    add_meta_box'myplugin_sectionid'__'WP Sub Posts''myplugin_textdomain' ), 'myplugin_inner_custom_box''page''advanced' );
       } else {
        
    add_action('dbx_post_advanced''myplugin_old_custom_box' );
        
    add_action('dbx_page_advanced''myplugin_old_custom_box' );
      }
    }

    function 
    myplugin_inner_custom_box() {
    echo 
    '
    <style type="text/css">
    select#parent_id, select#parent_id option {
        width:250px;
    }
    </style>

    '
    ;

    echo 
    '
    <input id="myplugin_noncename" name="myplugin_noncename" type="hidden" value="' 
    .
        
    wp_create_nonceplugin_basename(__FILE__) ) . '" />';  ?>
    <h5><?php _e('Parent'?></h5>

    <label for="post_parent">Please select the parent of this post</label>

    <?php 

    $currentid 
    $_GET['post'];
    wp_dropdown_posts(array('exclude_tree'             => $currentid,
                                
    'selected'             => $post->post_parent,
                                
    'name'                 => 'parent_id',
                                
    'show_option_none'     => __('Main Post (no parent)'),
                                
    'sort_column'        => 'menu_order, post_title'));
     }

    /* Prints the edit form for pre-WordPress 2.5 post/page */
    function myplugin_old_custom_box() {

      echo 
    '
    <div class="dbx-b-ox-wrapper">' 
    "\n";
      echo 
    '
    <fieldset id="myplugin_fieldsetid" class="dbx-box">' 
    "\n";
      echo 
    '
    <div class="dbx-h-andle-wrapper">
    <h3 class="dbx-handle">' 
    .
            
    __'WP Sub Posts''myplugin_textdomain' ) . "</h3>
    </div>

    "
    ;   

      echo 
    '
    <div class="dbx-c-ontent-wrapper">
    <div class="dbx-content">'
    ;

      
    // output editing form

      
    myplugin_inner_custom_box();

      
    // end wrapper

      
    echo "</div>
    </div>
    </fieldset>
    </div>

    \n"
    ;
    }

    /* When the post is saved, saves our custom data */
    function myplugin_save_postdata$post_id ) {

      
    // verify this came from the our screen and with proper authorization,
      // because save_post can be triggered at other times

      
    if ( !wp_verify_nonce$_POST['myplugin_noncename'], plugin_basename(__FILE__) )) {
        return 
    $post_id;
      }

      
    // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want
      // to do anything
      
    if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
        return 
    $post_id;

      
    // Check permissions
      
    if ( 'page' == $_POST['post_type'] ) {
        if ( !
    current_user_can'edit_page'$post_id ) )
          return 
    $post_id;
      } else {
        if ( !
    current_user_can'edit_post'$post_id ) )
          return 
    $post_id;
      }

      
    // OK, we're authenticated: we need to find and save the data

      
    $mydata $_POST['parent_id'];

       return 
    $mydata;
    }

    add_filter('posts_where','where_no_parent');
    add_filter ('the_content','subpost_template'1);

    function 
    subpost_template($content) {

        if(
    is_singular) {
        
    remove_filter('posts_where','where_no_parent');
        }
        echo 
    $content;

        
    $idnya get_the_ID();
        
    $child = new WP_Query("post_type=post&post_parent=".$idnya."");

        while(
    $child->have_posts()) : $child->the_post();
        echo 
    '
    <blockquote>

    '
    ;
        echo 
    '
    <h3>'
    ;
        
    the_title();

        echo 
    '</h3>

    '
    ;
        
    $childid =  get_the_ID();
        
    the_content();

        
    edit_post_link('Edit','','',$childid);
        echo 
    '</blockquote>

    '
    ;

        endwhile;
        
    wp_reset_query();
    }

    function 
    where_no_parent($where) {
        global 
    $wpdb;
         
    $where .= " AND post_parent  = 0";
         return 
    $where;
    }
    ?>

    ?>
    Revision by polvocdo

    subpost_template()

    subpost_template()

    <?php


        
    if(is_singular()) {
            
    remove_filter('posts_where','where_no_parent');
        }

        
    $parentID get_the_ID();
           
    $childposts get_posts(array(
                                    
    'post_type' => 'post',
                                    
    'numberposts' => -1,
                                    
    'post_status' => 'publish',
                                    
    'post_parent' => $parentID
                                    
    ));
          
    $subcontent "";
        foreach(
    $childposts as $childpost){
            
    $subcontent .= "
    <blockquote>

    "
    ;
            
    $subcontent .= "
    <h3>"
    .$childpost->post_title."</h3>

    "
    ;
            
    $subcontent .= $childpost->post_content;
            
    $subcontent .= '

    <a rel="nofollow" href="'
    .get_edit_post_link($childpost->ID).'">Edit</a>

    '
    ;
            
    $subcontent .= "</blockquote>

    "
    ;
        }

        
    $content .= $subcontent;

        return 
    $content;
    }

    <
    p>?>

    WP Dropdown Post

    wp_dropdown_posts()

    <?php</p>
    $currentid $_GET['post'];
    wp_dropdown_posts(array('exclude_tree'             => $currentid,
                                
    'selected'             => $post->post_parent,
                                
    'name'                 => 'parent_id',
                                
    'show_option_none'     => __('Main Post (no parent)'),
                                
    'sort_column'        => 'menu_order, post_title'));

    <
    p>?>
    Download

    You can download alpha version of this plugin here http://cektkp.com/wpsubpost
    If it not working please Click here

    Warning

    This plugin is Alpha version, use it for testing purpose only. Any problem caused by this plugin is not my responsibility.

    Demo:

    See below:

    Code Update WP Sub Post

    There are some changes to the WP Sub Post:

    • Fixed/Added, now child post can be viewed as a single post, with link to the Parent Post instead of displaying blank post with 'Post not found' title.
    • Added, CSS class and id to the blockquote of the child post. It would be useful to make a link like http://example.com/parentpost.html#childpostXXX. while XXX is your child post ID.

    Two functions that are changed subpost_template() and where_no_parent()

    WP Sub Post

    <?php
    function subpost_template($content) {
    global 
    $post;

    $parentID get_the_ID();
           
    $childposts get_posts(array(
                                    
    'post_type' => 'post',
                                    
    'numberposts' => -1,
                                    
    'post_status' => 'publish',
                                    
    'post_parent' => $parentID
                                    
    ));
          
    $subcontent "";
        foreach(
    $childposts as $childpost){
            
    $subcontent .= "
    <blockquote class=\"sub_post\" id=\"subpost_"
    .$childpost->ID."\">";
            
    $subcontent .= "
    <h3>"
    .$childpost->post_title."</h3>

    "
    ;
            
    $subcontent .= $childpost->post_content;
            
    $subcontent .= '
    <p class="postmetadata"><small>This sub post was added on: '
    .date('l, dS F, Y',strtotime($childpost->post_date)).' <a href="'.get_edit_post_link($childpost->ID).'" rel="nofollow">Edit</a></small>

    '
    ;
            
    $subcontent .= "</blockquote>

    "
    ;
        }

            if(
    $post->post_parent !== 0) {

            
    $parent_info '
    <blockquote>This post is a child post of <strong>'
    .get_the_title($post->post_parent).'</strong>. To view the parent post, please <a href="'.get_permalink($post->post_parent).'">click here.</a></blockquote>

    '
    ;
            
    $content $parent_info.$content;
            }

        
    $content .= $subcontent;
        return 
    $content;
    }

    function 
    where_no_parent($where) {
        global 
    $wpdb;
        if(!
    is_single()) {
         
    $where .= " AND post_parent  = 0";
        }
        else {
        
    $where .= " AND post_type = 'post'";
        }
        return 
    $where;
    }

    <
    p>?>

    Finally you can see the demo here

    Yesterday, I was failed to add a demo directly in this site because of incompatibility with smart tags (all smart tags are not working when WP Sub Post is activated).

    The problem comes from my old stupid function subpost_template():D

    Thanks and sorry to polvocdo :) , actually your revision is the answer.
    Ha ha I'm forget to replace mine with your revision  :hammer: ....


    This is a child post

    This is an individual post (http://takien.com/536/this-is-a-child-post.php) that attached to the another post ( http://takien.com/550/wordpress-plugin-wp-sub-post.php)

    image on the child post

    Child post could be useful when you want to add an additional information to the main post,  news analysis, or update. Instead of editing the main post, you can now simply Add New post and mark it as child post.

    Child post also has it's own functionality, can handle attachment, displaying image. etc.

    But you can't see this post in the post editing page (wp-admin/edit.php) because of filter  in the plugin to prevent child post to be displayed individually in the main page, post listing, feed, etc.  Hahaha.. don't worry, I will fix it soon.

    Incoming search terms:


    PHP: Keep HTML Tags Paired

    [14-Nov-2009]

    After applying substr to a string that contains HTML tags, usually I found that the result is broken because the closing tags are truncated.

    To prevent this, I have made a function that keep the closing tags remains and will not break the appearance of my website.

    Here is the function:

    HTML Pair Tags

    <?php</p>
    function 
    pair_tag($string) {
    $tags = Array('em','i','b','strong','div','span','p');
    //array of tags we will keep paired, you may add another
    foreach($tags as $tag) {

    $opentag     substr_count($string'<'.$tag);
    // I don't put > in the opentag in case they may have an attribute
    $closetag     substr_count($string'</'.$tag.'>');

    if(
    $opentag !== $closetag) {
    $return .= str_repeat('</'.$tag.'>', ($opentag-$closetag));
    }
    }
    return 
    $return;
    }
    <
    p>?>

    Usage/Example:

    Example

    <?php</p>
    $excerpt substr($string020);  //only display first 20 character
    $excerpt .= pair_tag($excerpt); // this will count any unclosed tags then close it.
    echo $excerpt// returns <p>This is my first pos</p>
    <p>?>

    Feedback and comment are welcome. Thanks

    Incoming search terms:


    How to fix ‘Function eregi() is deprecated’ in PHP 5.3.0?

    [21-Oct-2009]

    I used to use eregi for validating email address input that matches to the regular expression.

    <?php
    if(!eregi("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$"$str)) {
        
    $msg 'email is not valid';
    }
    else {
    $valid true;
    }
    <
    p>?>

    That would return true if given email address is matches to username@domain.ext pattern. Unfortunately, after upgrading PHP to the earlier version (5.3.0), it wont work properly. This is because eregi is one of several functions that are deprecated in the new version of PHP.

    Solution:
    Use preg_match with the 'i' modifier instead. i means that regular expression is case insensitive. So the code become like this:

    <?php
    if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i"$str)) {
        
    $msg 'email is not valid';
    }
    else {
    $valid true;
    }
    <
    p>?>

    The list of functions that are deprecated in PHP 5.3.0:

    • call_user_method() (use call_user_func() instead)
    • call_user_method_array() (use call_user_func_array() instead)
    • define_syslog_variables()
    • dl()
    • ereg() (use preg_match() instead)
    • ereg_replace() (use preg_replace() instead)
    • eregi() (use preg_match() with the 'i' modifier instead)
    • eregi_replace() (use preg_replace() with the 'i' modifier instead)
    • set_magic_quotes_runtime() and its alias, magic_quotes_runtime()
    • session_register() (use the $_SESSION superglobal instead)
    • session_unregister() (use the $_SESSION superglobal instead)
    • session_is_registered() (use the $_SESSION superglobal instead)
    • set_socket_blocking() (use stream_set_blocking() instead)
    • split() (use preg_split() instead)
    • spliti() (use preg_split() with the 'i' modifier instead)
    • sql_regcase()
    • mysql_db_query() (use mysql_select_db() and mysql_query() instead)
    • mysql_escape_string() (use mysql_real_escape_string() instead)
    • Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead.
    • The is_dst parameter to mktime(). Use the new timezone handling functions instead.

    Ref:

    http://php.net/manual/en/migration53.deprecated.php

    Incoming search terms:


    Mencari dan Mengganti String dalam Database MySQL dengan phpMyAdmin

    [20-Jun-2009]

    Kadangkala kita perlu mengganti suatu teks langsung dari database mySQL menggunakan phpMyAdmin. Hal ini tentu mudah saja dilakukan jika teks yang akan diganti jumlahnya cuma sedikit.

    Nah, bagaimana cara merubah teks yang berjumlah banyak dalam database tersebut dengan cepat tanpa mengekspor database?

    Hal itu bisa dilakukan menggunakan perintah SQL, caranya bukalah phpMyAdmin, kemudian buka tab SQL dan ketikkan perintah berikut:

    UPDATE namatabel SET namakolom = replace(namakolom,"teksyangdicari","tekspengganti");

    Contoh berikut akan mengganti semua teks google.com dalam posting wordpress menjadi yahoo.com.

    UPDATE wp_posts SET post_content = replace(post_content,"google.com","yahoo.com");

    Update: (22 Juni 2009)
    Malu aku, posting ini dibaca oleh sang master juga ternyata.

    Tapi gak apa-apa, itu menandakan masih punya kemaluan.
    Si master tadi ngasih solusi yang lebih cepat lebih baik (bukan kampanye, red).

    Kata dia cukup pakai ini aja:

    "UPDATE wp_posts SET `post_content` = 'google.com' WHERE `post_content` = 'yahoo.com'" ;

    Standard MySQL tuh, katanya menambahkan.

    Weleh-weleh, yo wis lah, makasih oom, ntar tak hadiahin chika versi manohara deh sekalian tak gendong kemana-mana.

    NB: google.com dan yahoo.com diatas hanyalah sebagai contoh saja, bukan bermaksud mempromosikan kedua situs tersebut apalagi menyemarakkan nama baik.

    Incoming search terms:


    Club Cooee, Animated 3D Instant Messaging Yang Keren Abis

    [25-Dec-2008]

    Club CooeeSetelah sekian lamaaa banget nggak posting di blog ini, akhirnya... posting lagi ah...! Kali ini aku mau mengulas sedikit tentang sebuah aplikasi baru yang keren abis, yaitu Club Cooee. Sebuah aplikasi Instant Messaging ( semacam chatting ) yang dibuat sedemikian rupa sehingga menyerupai dunia nyata alias real.

    Hal ini sebenarnya sudah lama diterapkan dalam aplikasi-aplikasi game online yang telah lama dikenal banyak orang.
    Tapi ClubCooee lebih dititikberatkan penggunaanya untuk chatting, bukanlah sebuah permainan belaka. Namun demikian...

    Incoming search terms:


    Tips dan Trick CSS (Bagian I)

    [10-Sep-2008]

    Penggunaan CSS (Cascading Style Sheets) sudahlah mutlak dalam mendesain sebuah website. Dengan CSS hampir semua format tampilan dapat kita deklarasikan hanya melalui sebuah file, sehingga halaman lebih cepat di load, selain dapat dengan mudah jika suatu saat ingin menggantinya. Namun terkadang masih banyak terdapat kesalahan dimana terjadi banyak pengulangan-pengulangan yang tidak penting. Juga penggunaan ID dan class yang salah tempat. Sehingga tujuan penggunaan CSS untuk mempercepat loading halaman jadi tidak tercapai.

    Berikut beberapa tips dalam menuliskan CSS:

    1. Hindari penggunaan ID ganda.

    ID adalah sebuah penanda unik untuk sebuah elemen halaman, artinya dalam sebuah halaman tidak ada dua ID dengan nama yang sama. Jadi, gunakanlah ID hanya untuk elemen-elemen utama yang tidak ada duanya, seperti header, menu, container, sidebar, footer dsb.

    Contoh1:

    Contoh2:

    Contoh2 di atas adalah salah, karena kemungkinan besar elemen title dan post adalah lebih dari satu dalam sebuah halaman.

    Solusinya gunakanlah class daripada ID.

    2. Buang nilai-nilai yang mubazir

    Kita lihat contoh CSS berikut:

    Contoh3

    #container {
    padding-top: 5px;
    padding-right: 0px;
    padding-bottom: 5px;
    padding-right: 0px;
    }

    Contoh4

    #container {
    padding: 5px 0px 5px 0px;
    }

    Contoh3 dan Contoh4 di atas akan menghasilkan tampilan yang sama, tentu saja contoh4 lebih sederhana daripada contoh3. Namun demikian, contoh4 tersebut masih terdapat perulangan nilai 5 dan 0. Mari kita perbaiki menjadi sebagai berikut:

    Contoh5

    #container {
    padding: 5px 0;
    }

    Wow, sederhana bukan? Ya, karena nilai pertama sudah dapat mewakili top dan bottom, dan nilai kedua sudah mewakili left dan right. Sementara untuk zero value (0) tidak perlu menambahkan satuan px, jadi boleh dihilangkan.

    3. Bijak dalam memberikan nilai warna

    Asumsikan kita akan memberi latar warna biru untuk div container, css nya adalah sebagai berikut.

    Contoh6

    #container {
    background: #0000FF;
    }

    Contoh6 akan menghasilkan warna background dari div container menjadi berwarna biru. Kode tersebut bisa dipersingkat lagi menjadi sebagai berikut:

    Contoh7

    #container {
    background: blue;
    }

    Ya, karena nilai #0000FF sama artinya dengan blue. Lebih singkat bukan?

    Beberapa alternatif lain dalam memberikan warna seperti tertera dalam table berikut:

    alternatif1        alternatif2          alternatif3            hasil warna
    #000000           #000                  black                   hitam
    #FFFFFF           #FFF                  white                  putih
    #FFFF00           #FF0                  yellow                 kuning
    #FF0000           #F00                  red                     merah

    Di sinilah kebijakan kita dituntut, dimana kita harus bisa memilih mana yang paling sedikit karakternya. Misalnya untuk memberi warna kuning, maka lebih baik menggunakan #FF0 dari pada yellow, sementara untuk memberi warna merah, lebih baik menggunakan red, daripada #F00. Pemberian nama warna langsung kemungkinan tidak terbaca oleh semua browser, tapi untuk warna2 dasar hal ini masih bisa ditolelir.

    Untuk lebih jelasnya dalam menentukan kode warna, bisa dilihat color chart di sini.

    4. Semicolons, hanya untuk pemisah

    Kita lihat contoh berikut

    Contoh8

    #container {
    background: blue;  /*terdapat semicolon (titik koma) setelah nilai blue.*/
    }

    Jika hanya ada sebuah properties, kita tidak perlu mengakhirinya dengan titik koma (;) atau semicolon.
    Jadi CSS yang baik adalah.

    Contoh9

    #container {
    background: blue
    }

    Demikian juga jika sebuah nilai tidak diikuti oleh nilai lainnya, maka semicolon bisa dihilangkan.

    Contoh10

    #container {
    background: blue;
    padding: 5px 0;
    margin: 0
    }

    Setelah nilai margin: 0 kita tidak perlu lagi menambahkan semicolon, karena properties untuk container sudah berakhir.

    6. Kelompokkan nilai yang sama.

    Misalkan div header, div sidebar, dan div footer mempunyai beberapa nilai yang sama, kita bisa mengelompokkannya dengan memisahkannya dengan koma.

    Contoh11

    #header, #sidebar, #footer {
    background: red;
    font-family: Arial, Helvetica;
    padding: 5px

    5. Kurangi spasi yang berlebihan

    Sedapat mungkin kurangi penggunaan spasi kosong yang berlebihan.
    Untuk contoh10 di atas, bisa kita padatkan lagi menjadi

    Contoh12

    #container {
    background:blue;
    padding:5px 0;
    margin:0
    }

    Atau bahkan

    Contoh13

    #container {background:blue;padding:5px 0;margin:0}

    Namun contoh13 tidak dianjurkan, karena akan merepotkan kita sendiri sewaktu-waktu ingin merubah tampilan nantinya.

    Demikian beberapa tips yang mungkin berguna, sebenarnya masih ada beberapa tips lagi yang mungkin lain kali bisa disambung lagi. :)

    Incoming search terms:


    Tips dalam memilih Nama Domain

    [28-Aug-2008]

    Memilih nama domain seperti memilih pasangan hidup. Keterlaluan sepertinya ya? Tetapi setidaknya ada beberapa tips yang perlu diperhatikan, jika kita benar-benar ingin menghidupkan sebuah website. Berikut tips yang saya kumpulkan dari berbagai sumber dan juga pengalaman pribadi:

    1. Kesesuaian

    Ini sudah jelas, sebuah nama domain harus dapat mewakili atau sesuai dengan isi dari sebuah website itu sendiri. Jadi ketika seseorang melihat sebuah domain akan langsung bisa menebak apa isinya.

    2. Generik

    Carilah nama-nama umum, yang biasa disebutkan dan dimengerti orang banyak. Sepertinya hal ini sangat susah mengingat hampir semua nama-nama umum sudah didaftarkan orang, tapi kalau kita kreatif dan sabar pasti dapat hasil yang bagus pula.

    3. Pendek

    Masih ingat dengan domain terpanjang di Indonesia atau di dunia? Hah, itu tidak lain hanya untuk sensasi saja. Intinya, makin pendek makin baik

    4. Tanda hubung ( - )

    Sedapat mungkin hindari penggunaan tanda hubung seperti nama-perusahaan.com. Kenapa? Karena akan terasa sukar dan panjang sewaktu kita menyebutkannya secara lisan atau melalui telepon, mau tidak mau harus seperti ini: "Website kami adalah nama tanda hubung perusahaan dot com" daripada nama perusahaan dot kom.

    5. Angka

    Penggunaan angka dalam sebuah nama domain adalah kurang baik, kecuali angka tersebut merupakan bagian dari nama perusahaan. Contohnya: trans7, indonesia5 dsb.

    6. Dot com

    Kenapa dot com? Karena dot com lebih memiliki kredibilitas dibanding dengan extensi lainnya, selain paling mudah diingat dan diketikkan orang.

    7. Awalan / akhiran

    Nama yang kita inginkan sudah diambil orang? Cobalah untuk menambahkan awalan atau akhiran yang relevan. Contohnya: ponsel.com sudah didaftarkan, cobalah ponselku.com atau jualponsel.com

    8. Legalitas

    Perhatikan bahwa nama domain yang ingin anda daftarkan bukanlah nama sebuah merek atau sesuatu yang telah terdaftar hak cipta-nya. Karena sewaktu-waktu mereka bisa menuntutnya.

    9. Banyak TLD

    TLD adalah top level domain atau extensi yang paling populer seperti .COM/.NET/.ORG. Daftarkan domain anda lebih dari satu TLD. Gunanya adalah untuk mencegah penggunaan nama domain kita oleh pesaing meskipun dengan TLD yang berbeda. Selain itu juga untuk menjaga jika pengunjung salah mengetikkan TLD.

    10. Konsultasi

    Tidak kalah penting juga untuk mengkonsultasikan nama domain yang akan anda beli dengan rekan atau teman. Karena sesuatu yang baik bagi kita belum tentu baik bagi orang lain atau bahkan mereka bisa menyumbangkan ide lebih baik lagi. Tapi ingat, jangan sembarangan berkonsultasi sebelum membeli sebuah domain, bisa-bisa domain tersebut lebih duluan didaftarkannya.

    11. Lihat sejarah domain, pastikan bukan spam

    Bila domain anda pernah didaftarkan sebelumnya oleh orang lain (expired/deleted domain). Cobalah lakukan pencarian di search engine (e.g Google.com) dan pastikan domain tersebut tidak digunakan oleh spammer maupun scammer. Karena bila hal itu terjadi, bisa saja nama tersebut telah diblacklist dari berbagai search engine atau bahkan telah diblacklist dari beberapa negara maupun ISP.

    12. Rencana pengembangan ke depan

    Anda menjual baju olahraga dan anda membeli domain untuknya dengan nama bajuolahraga.com. Pastikan sampai kapanpun anda menjual baju olah raga dan bukan baju anak-anak atau busana muslim. Jika anda berencana mengembangkan usaha untuk menjual segala macam baju, maka sebaiknya belilah domain dengan nama jualbusana.com atau tokobusana.com karena cakupannya lebih luas.

    13. Lokalisasi

    Pengunjung adalah segalanya. Oleh karena itu perhatikan juga target pengunjung website kita nantinya. Jika target pengunjung anda masyarakat Indonesia, tidaklah masalah jika anda memilih domain dengan extensi .id seperti .co.id atau web.id. Tapi ingat, bagaimanapun TLD dot com is the best ( if available )

    14. Mudah dilafalkan, hindari ambiguitas

    "Pakai c apa pakai k?", "Ujungnya pakai s apa enggak?". Itu adalah salah satu contoh ketika sebuah nama domain mengandung kata/huruf yang dapat menimbulkan kebingungan orang yang mendengarnya ketika disebutkan. Hindari.

    15. Mudah diingat

    Kalau beberapa kriteria sebelumnya sudah dipenuhi, otomatis nama domain akan mudah diingat. Pendek, umum, mudah dilafalkan, dot com, sesuai dengan isi.

    16. Nama yang mirip

    Cobalah buka gogle.com, gpple.com, goole.com atau googel.com. Hasilnya adalah website yang sama bukan?

    Nah, daftarkan juga beberapa domain yang ejaan maupun penulisannya mirip atau menyerupai dengan domain yang akan dibeli. Hal ini untuk menjaga sewaktu-waktu pengunjung salah mengetikkan alamat website anda.

    17. Gunakan bentuk jamak ( english only)

    Bahasa Inggris membedakan bentuk jamak dengan menambahkan akhiran -s. Jika anda berencana membeli domain untuk toko bunga anda cobalah untuk memilih yang berbentuk jamak seperti flowers.com daripada flower.com. Karena yang kita jual adalah banyak bunga bukannya satu bunga.

    18. Kreatif

    Kreatifitas adalah tanpa batas. Jadi walaupun anda tidak dapat memenuhi kriteria di atas, anda masih bisa mendapatkan domain yang bagus dengan cara harus kreatif.

    19. Hati-hati dengan Whois

    Memeriksa ketersediaan domain melalui whois service terkadang 'membahayakan', kenapa? Karena mereka akan merecord pencarian kita dan kalau domain yang mau kita daftarkan termasuk banyak yang me-whois. Pihak situs akan meregister domain tersebut karena dikira "valuable", selanjutnya mereka jual dengan harga tinggi.

    Cara aman untuk mengecek ketersediaan domain diantaranya dengan mengetikkannya langsung di browser, atau dengan ping test (lakukan ping ke domain tersebut). Jika website tidak terbuka atau IP tidak tertera, kemungkinan masih available. Namun hal ini tidak 100% bisa dipercaya karena domain yang tidak di map (dipointing ke nameserver) akan menampilkan pesan page not found atau ping time-out.

    20. Compromise

    Dari sekian banyak tips yang dijabarkan di atas, sepertinya saat ini sangat sulit sekali untuk memenuhi semua kriteria tersebut. Namun sedikitnya setengah saja tips dan syarat dapat dipenuhi, anda sudah mendapatkan sebuah domain yang bagus.

    Dan jangan lupa, kunci suksesnya adalah kemauan dan keyakinan yang kuat dalam membangun sebuah website. Karena, sekeren apapun domainnya akan tidak bernilai jika pengunjung hanya mendapati halaman Under Construction sepanjang masa. Belum punya waktu untuk membangun website sementara domain sudah dibeli? Parkirkan saja domainnya di Sedo, Parked atau NameDrive. Selain dapat menghasilkan $$$, siapa tahu ada pihak lain yang berminat membeli domain tersebut.

    Incoming search terms:


    Membuat Private NS Sendiri

    [28-Aug-2008]

    Ketika menyewa sebuah webhosting, kita biasanya diberi informasi account dan informasi nameserver dengan format NS1.NAMAHOSTING.COM dan NS2.NAMAHOSTING.COM. Nama server tersebut nantinya akan bisa dilihat publik ketika melakukan Whois ke domain kita sehingga orang lain akan tahu dimana kita menyewa hosting.

    Sebenarnya kita bisa membuat nameserver sendiri dengan format NS1.DOMAINKITA.COM dan NS2.DOMAINKITA.COM. Untuk dapat membuat nameserver sendiri syaratnya adalah kita harus punya akses ke control panel domain yang memungkinkan mengedit DNS Zone. Beberapa registrar domain yang memungkinkan kita membuat nameserver sendiri (tanpa biaya tambahan) diantaranya Godaddy.com, Name.com, Dynadot.com

    Berikut tutorial untuk membuat nameserver di Godaddy.com

    - Login ke account di Godaddy.com

    - Masuk ke domain management dengan mengklik menu My Domain

    - Klik salah satu domain yang akan dibuat nameservernya

    - Scroll ke bawah, di situ tertera tertera Host Summary (add), klik pada link (add)

    - Pada kotak hostname isikan NS1, pada kotak Host IP1 isikan no IP untuk NS1

    - Ulangi sekali lagi untuk NS2, pada kotak Host IP1 isikan no IP untuk NS2

    - Klik OK jika sudah selesai. Nameserver akan aktif dalam waktu paling lama 48 jam.

    NB:

    Untuk mendapatkan no IP. lakukan ping ke NS1.NAMAHOSTING.COM dan NS2.NAMAHOSTING.COM (sesuai yang diberikan pihak webhosting), caranya ketikkan di Start -> Run ping ns1.namahosting.com -t dan tekan Enter, demikian juga untuk NS2-nya.

    Trik ini hanya untuk merubah nameserver, dimana orang lain masih tetap dapat melihat dimana kita menyewa hosting dengan melakukan trace-route. :D

    Incoming search terms:


    Memiliki Email Pribadi Tanpa Membeli Hosting

    [26-Aug-2008]

    Mungkin sudah banyak yang tahu apa itu Google Apps. Bagi yang belum tahu, itu adalah layanan gratis dari Google yang menawarkan berbagai fasilitas menarik, salah satunya inbox email sebesar kurang lebih 6GB secara gratis layaknya Gmail. Uniknya lagi, layanan gratis ini bisa menggunakan domain sendiri artinya alamat email Anda bukanlah username@gmail.com tapi username@namaanda.com.

    Hal yang perlu diperhatikan untuk dapat menikmati layanan ini adalah, tentu saja, harus terlebih dahulu mempunyai domain, mengedit MX entry dan mengarahkannya (pointing) ke ghs.google.com. Beberapa penyedia layanan domain membebankan biaya tambahan untuk dapat mengedit MX/DNS Zone, atau alternatifnya mengarahkan domain tersebut ke webserver / hosting dan mengedit MX entry dari cPanel atau WHM. Setidaknya selain harus membeli domain, juga diharuskan membeli layanan manage MX/DNS Zone, atau membeli webhosting untuk dapat mengedit MX entry. Estimasinya dibutuhkan biaya sekitar Rp. 120 ribu ( domain rata-rata Rp 80rb ditambah biaya hosting atau MX/DNS).

    Bagaimana jika Anda hanya ingin menggunakan fasilitas email tanpa bermaksud membangun website? Tentu saja webhosting yang terlanjur dibeli tersebut akan menjadi mubazir, karena tidak lebih hanya sebagai tempat numpang lewat.

    Untung saja ada sebuah registrar (tempat melakukan registrasi domain) yang baik hati, yang menyediakan layanan Google Apps secara 'built up'. Name.com namanya. Setelah mempunyai akun (dengan membeli minimal satu domain) di name.com, Anda langsung dapat Google Apps dengan beberapa klik.

    1. Pilih domainnya, klik tombol Add for Selected Domain(s)

    2. Klik Enable, untuk mulai setup Account Google Apps.

    Ikuti petunjuk selanjutnya untuk men-setup account Google Apps, dalam beberapa menit kemudian Anda bisa langsung dapat menggunakan fasilitas dari Google tersebut dengan gratis, dan dengan nama domain Anda sendiri. Bahkan Anda dapat memberikan akun email tersebut kepada teman Anda seperti temananda@namaanda.com. Hebat kan! :D

    NB: Saat posting ini ditulis, harga domain di Name.com adalah $5.99 USD atau sekitar Rp. 55.000,- berlaku untuk satu tahun.

    Incoming search terms:


    News Archive