Saturday 21 June 2014

Simple Contact book in laravel to understand laravel named routes clearly

Hello friends i am back again with yet another simple application in laravel but this time the real motive behid this application to understand the named routes in laravel.

You can download the complete source code i have also include the sql file just setup the app, and study the codes i have kept the application as simple as possible to understand the routes and how they work.

If you guys face any problem do comment.

Download Code

Thursday 19 June 2014

Codeigniter Login Script With Login Attempt And Session Based User Blocking

Codeigniter Login Script With Login Attempt And Session Based User Blocking

Hello guys/girls in the post you will get to learn how to log in a user and block him/her upon 3 invalid login attempts.

This is really simple and easy in codeigniter it will only take 20 minutes to complete this section.

You can download the complete code from below

 Download Code

Tuesday 27 May 2014

URL Shortner Application in Laravel

Hello friends today we will create a url shortner application in Laravel 4, where will will use the get,post Http verbs to show the form on load and to process the form.

First of all you have to install laravel through composer if you already have laravel install you are good to go otherwise do install it first.

First Create a database call it laravelurlshortner (or any name you like.)  and in your app/config/database change the database name you have just created in database.

Now create a migration for your database to create tables,don't worry guys if you don't know how to create a migration i will look after that..

First go you your terminal (cmd) and go the exact url like below image and copy


 and in your termnal chnage the path by just typing cd then what you have copied and press enter
and type :- php artisan migrate:make create_links_table -- create

And go the app/database/migrations and you will notice  your migration is generated.

open it in your editor

and replace it with this code---

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLinksTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('links',function($t){

$t->increments('id');
$t->text('url');
$t->string('hash',400);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('links');
}

}

------------------------------------------------------------------------------------------------

Now again open your terminal and type:- php artisan migrate

And now visit your database and you will notice that your link tables has been created.

--------------------------------------------------------------------------------------------------

You can download the full code from  --- http://www.mediafire.com/download/1677raomrhq9a2n/laravelurlshortner.rar

Just download the code and look into the controllers and routes and models section..

Thank You...

Monday 14 April 2014

Creating and understanding SEO-Friendly URL'S Part 2

First guys we will look how a slug url look like 

http://www.example.com/This-is-a-seo-friendly-url

This is a  demo and this is what we are looking to achieve

So lets's the hacking begin.......

First we will create  a function which will handle the preparation of a slug url

<?php
    function generate_slug($slug)
  {
echo $text = "TTutorial to    show you how to create a ----- safe slug url v`v`k``` generator";
        echo "<br/>";
 ///// first remove everyting  other than spaces,hypens,number,letters and make the string to lowercase 
        echo $remove_slug1 = preg_replace("/[^\-\s\pN\pL]+/u", " ", mb_strtolower($text,'UTF-8'));

   echo "<br/>";
    /////  remove duplicate hypens and spaces//////
   echo $remove_slug2 = preg_replace("/[\-\s]+/", "-", $remove_slug1);
   echo "<br/>";
   echo $remove_slug3  = trim($remove_slug2,"-");
}
?>


Creating and understanding SEO-Friendly URLS Part 1

Clean URLs, RESTful URLs, user-friendly URLs or SEO-friendly URLs are purely structural URLs that do not contain a query string [e.g., 
action=delete&id=91] and instead contain only the path of the resource (after the scheme [e.g., http] and the authority [e.g., example.org]). This is often done for aesthetic, usability, or search engine optimization (SEO) purposes. Other reasons for designing a clean URL structure for a website or web service include ensuring that individual web resources remain under the same URL for years, which makes the World Wide Web a more stable and useful system, and to make them memorable, logical, easy to type, human-centric, and long-lived


Examples of "unclean" versus "clean" URLs follow:
Unclean URLClean URL
http://example.com/index.php?page=foohttp://example.com/foo
http://example.com/index.php?page=consulting/marketinghttp://example.com/consulting/marketing
http://example.com/products?category=2&pid=25http://example.com/products/2/25
http://example.com/cgi-bin/feed.cgi?feed=news&frm=rsshttp://example.com/news.rss
http://example.com/services/index.jsp?category=legal&id=patentshttp://example.com/services/legal/patents
http://example.com/kb/index.php?cat=8&id=41http://example.com/kb/8/41
http://example.com/index.php?mod=profiles&id=193http://example.com/profiles/193
What is Slug ?
A slug is the part of a URL which identifies a page using human-readable keywords. It is usually the end part of the URL, which can be interpreted as the name of the resource, similar to the basename in a filename or the title of a page. The name is based on the use of the word slug in the news media to indicate a short name given to an article for internal use. For example, in

http://www.example.com/services/legal/medical-patents
Hope you guys have understood something about SEO Friendly URls
In the next part we will create a slug function to create a  seo friendly URL.

Wednesday 19 March 2014

Simple And Really Cool Page turning Animation in JQUERY With TURN.JS

Guys This is just a demo how to implement turn.js you can find the demo below.

turn.js is  a readymade file through which you can implement this animation effect.

You can google it and download it from github.

I just created a sample and will release the codes and  teach you guys how to implement turn.js

So stay tuned and for now you can check the demo.

And if you guys like it do comment

LIVE DEMO

Tuesday 18 March 2014

Some basic selecting methods in JQUERY

The jQuery library allows you to select elements in your XHTML by wrapping them in $("") (you could also use single quotes), which is the jQuery wrapper. Here are some examples of “wrapped sets” in jQuery:

$("div"); // selects all HTML div elements

$("#myElement"); // selects one HTML element with ID "myElement"

$(".myClass"); // selects HTML elements with class "myClass"

$("p#myElement"); // selects HTML paragraph element with ID "myElement"

$("ul li a.navigation"); // selects anchors with class "navigation" that are nested in list items

jQuery supports the use of all CSS selectors, even those in CSS3. Here are some examples of alternate selectors: 

$("p > a"); // selects anchors that are direct children of paragraphs

$("input[type=text]"); // selects inputs that have specified type

$("a:first"); // selects the first anchor on the page

$("p:odd"); // selects all odd numbered paragraphs

$("li:first-child"); // selects each list item that's the first child in its list

jQuery also allows the use of its own custom selectors. Here are some examples: 

$(":animated"); // selects elements currently being animated

$(":button"); // selects any button elements (inputs or buttons)

$(":radio"); // selects radio buttons

$(":checkbox"); // selects checkboxes

$(":checked"); // selects checkboxes or radio buttons that are selected

$(":header"); // selects header elements (h1, h2, h3, etc.)