An Introduction to Kohana3 PHP Framework

December 12, 2010 No comments yet

This is a brief introduction into the Kohana framework. The next two tutorials will cover how to build a blog in Kohana.

Installation

Installing Kohana is very straight forward, just download the latest stable version of Kohana and unzip it. No need to mess around with yaml or xml files like other frameworks. Navigating to the directory on your web server should give you a page similar to…

Filesystem

The filesystem plays a big part in the operation of the Kohana framework. Kohana follows the HMVC pattern (hierarchical model view controller). This means that the same filesystem structure exists at multiple locations in the framework. The following directories exist in the application, system and in all module directories:

  • classes
  • config
  • i18n
  • messages
  • tests

When calling a class in Kohana, the autoloader checks if the class exists first in application/classes/ , then in each of the installed modules, classes subdirectory and finally in system/classes/. If the file cannot be found then an exception is thrown. Kohana follows the Zend_Class_Naming style. For example, if you instantiated a class named Hello_World, Kohana would look at each of the following locations in this order. If it finds that…

Internationalization and Partial Rendering in the CodeIgniter Framework

September 6, 2010 No comments yet

As experienced Web developers, it won’t shock you to find literally thousands of comparisons between CodeIgniter and the other popular frameworks you may be considering for your site. Each framework has its good and, ummm… less good points, but

Scrape the First Paragraph & Image from a Wikipedia Entry

July 26, 2010 No comments yet

Automate fetching Wikipedia descriptions and images for webpage content. Render content dynamically based on specific keywords.

Blogger Template Wizardry

June 4, 2010 No comments yet

Google’s Blogger is the eighth most popular site on the entire Web today, and by far the most popular free blogging site. According to Google, Blogger now hosts over 300 million blogs and publishes 388 million words per day – simply staggering figures. Let’s look at some of the more compelling reasons for Blogger’s popularity.

Working with Google’s Language API

March 7, 2009 3 comments

Google translate is used by millions of people every day. Combine this with the easy reporting of language errors/mistakes makes it one of the most comprehensive and accurate online translators. Google provides an easy to use API to access their large language database, we’ll be using that today.

It will consist of two textareas, two dropdowns and one button. It will look something like this:

HTML

The HTML code is fairly straight foward. Notice the dropdown menus have values. These are essential as this is the language code, it’s sent to Google.

<body>
<div class="he">
<h2>Translate</h2>
From:
<select id="from">
<option value=sq>Albanian</option><option value=ar>Arabic</option><option value=bg>Bulgarian</option><option value=ca>Catalan</option><option value=zh-CN>Chinese (Simplified)</option><option value=zh-TW>Chinese (Traditional)</option><option value=hr>Croatian</option><option value=cs>Czech</option><option value=da>Danish</option><option value=nl>Dutch</option><option value=en selected>English</option><option value=et>Estonian</option><option value=tl>Filipino</option><option value=fi>Finnish</option><option value=fr>French</option><option value=gl>Galician</option><option value=de>German</option><option value=el>Greek</option><option value=iw>Hebrew</option><option value=hi>Hindi</option><option value=hu>Hungarian</option><option value=id>Indonesian</option><option value=it>Italian</option><option value=ja>Japanese</option><option value=ko>Korean</option><option value=lv>Latvian</option><option value=lt>Lithuanian</option><option value=mt>Maltese</option><option value=no>Norwegian</option><option value=pl>Polish</option><option value=pt>Portuguese</option><option value=ro>Romanian</option><option value=ru>Russian</option><option value=sr>Serbian</option><option value=sk>Slovak</option><option value=sl>Slovenian</option><option value=es>Spanish</option><option value=sv>Swedish</option><option value=th>Thai</option><option value=tr>Turkish</option><option value=uk>Ukrainian</option><option value=vi>Vietnamese</option>
</select>

To:
<select id="to">
<option value=sq>Albanian</option><option value=ar>Arabic</option><option value=bg>Bulgarian</option><option value=ca>Catalan</option><option value=zh-CN>Chinese (Simplified)</option><option value=zh-TW>Chinese (Traditional)</option><option value=hr>Croatian</option><option value=cs>Czech</option><option value=da>Danish</option><option value=nl>Dutch</option><option value=en selected>English</option><option value=et>Estonian</option><option value=tl>Filipino</option><option value=fi>Finnish</option><option value=fr>French</option><option value=gl>Galician</option><option value=de>German</option><option value=el>Greek</option><option value=iw>Hebrew</option><option value=hi>Hindi</option><option value=hu>Hungarian</option><option value=id>Indonesian</option><option value=it>Italian</option><option value=ja>Japanese</option><option value=ko>Korean</option><option value=lv>Latvian</option><option value=lt>Lithuanian</option><option value=mt>Maltese</option><option value=no>Norwegian</option><option value=pl>Polish</option><option value=pt>Portuguese</option><option value=ro>Romanian</option><option value=ru>Russian</option><option value=sr>Serbian</option><option value=sk>Slovak</option><option value=sl>Slovenian</option><option value=es>Spanish</option><option value=sv>Swedish</option><option value=th>Thai</option><option value=tr>Turkish</option><option value=uk>Ukrainian</option><option value=vi>Vietnamese</option>

</select>
</div>

<div class="tebg">

See, Yes! Yes! – GO

December 9, 2008 2 comments

Modular CSS needs to be developed and all inherited properties needs to commented within CSS declaration so one don’t repeat same CSS again and selectors needs to named by some naming convention (e.g. prefixing every declaration by module).

Modules needs to be devised in such way so it remain plug and play if plugged in different application.

See, Yes! Yes! – STEADY

November 12, 2008 1 comment

Not every validated webpage is accessible or ideal but every invalid web page is bad. So always try to validate. First by validating from validators and then by common sense, because technically a page with thousands of nested DIVs are valid. button stimulated out of div is valid. But question is… Is it really?

See, Yes! Yes! – READY

October 28, 2008 4 comments

In today’s web arena, CSS has proved its importance in rigid way. Web content is no more targeted to web browsers only, Web content is been served for a verity of media now days. To efficiently handle such situation CSS plays a very crucial role.

In order to extract maximum pulp from CSS fruit there are few things needs to keep in mind. Although rule of thumb is efficiency is directly proportional to experience but I’ll point out few options 3-part post series See, Yes! Yes! – READYSee, Yes! Yes! – STEADY and See, Yes! Yes! – GO. which can help novice CSS developers to take right diversions.

All of following points are optional and one can modify them according to needs and/or simply drop the idea.

Big Picture:

Planning is a must for mid or big projects…for small projects one can instantly start coding.

While coding for new design, web designer must analyze the design mock-up and slice the design by keeping in mind the facts which are resultant of observation and guideline of website/blog/web application.

e.g.

  • What portion of design mock can be translated by using CSS rules instead

A Tableless Table – Exploring the power of CSS3

October 27, 2008 3 comments

The recent browser versions like Firefox 3, Google Chrome, Internet Explorer 8, Opera 9.5 and Safari 3 are now coming with a great and brand new support: CSS3. Some of the new properties are introduced and here I am going to describe the table value for the display property.

To align data in a tabular structure we can use a common table using the HTML tags <table>, <tr>, <td> nonetheless we all know that by using that we are violating the latest web standards, right?But hold on for a second. I’m just going to introduce you a hot new way to code it using nothing else than div tags with the great CSS3 and the data will appear just like a table. Believe, that’s true!

Here is an example:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Some Page</title>
<style type="text/css">
.table {
display: table;
width:100%;
}
.row {
display: table-row;
width:100%;
}
.cell {
display: table-cell;
border: 1px solid blue;
padding: 1em;
width: 33%;
}
.element1 {
background:#0099FF;

Apache SSL – For Secure online transactions

October 24, 2008 No comments yet

Hey you are planning to start a e-commerce website, then you must know about SSL without which no one will trust your website as a safe place to use their cards…

What is SSL?

SSL (Secure Socket Layer) is a protocol used for secure data transfer. This is done by using private keys and certificates. A private key is used to encrypt the data which you are sending and the server can only decrypt this data with the private key available with it, A certificate is used to authentic yourself before proceeding.

So we need two things to make our website secure for online transactions. In this article i will explain how to generate a private key with open-ssl and apache, how to generate a certificate request from CA (Certificate Authority). How to configure your server to respond for ssl requests.

We use Apache 2, Debian Linux, Openssl for this article.

First step is to install Apache:

Go to console mode

aptitude install apache2

next install openssl to generate keys and certificates or certificate requests

aptitude install openssl

next generate certificate request and key using openssl

openssl req -new -nodes