Create your own WordPress theme from scratch [Part 5]

Well, we have coded index.php, header.php, content.php, sidebar.php, and now the one that is left is footer.php . I don’t know what all to add to footer.php except this code.

If you like to add anything more than this to the footer, then please be free to do so.

Now, if you have activated this test theme already in the wp dashboard. Now, just refresh the homepage. You see that there is only a lengthy plain text. Because, we haven’t yet coded the theme completely.

(It is better if you add demo content to the wordpress http://codex.wordpress.org/Theme_Unit_Test)

plain

As you can see we haven’t add your blog title to the theme yet. So, we gonna open the header.php again and add this code at the end of the previous code.

The aim of the above code is to echo the blog title and description at the top of the page.

Now, after adding the code to the header.php the total code in header.php must look like this.

Basically, we have completed coding our theme here. We shall now start with the styling, with css code. Start adding css code to the style.css page.

It will make the page perfectly aligned, and fluid. Check it below.

Wordpress theme full page preview.
WordPress theme full page preview.

Now you should start choosing pictures, colors and everything else by yourselves and start adding.

Here completes the creation of WordPress theme. It was totally tested and worked on 2014’s WordPress release.

PREVIOUS PART
Create your own WordPress theme from scratch [Part 4]

Create a chat box for your site with HTML/CSS, jQuery, PHP and MySQL

Well, it is fun to chat with the people who use same site I use, we can share informations, updates, even jokes sometimes. All it is possible with chat box, we can also make them be occupied for long on the site using this technique. We can create a chat box for websites, blogs, forums easily using jQuery, PHP and MySQL.

Here is a tutorial to build a totally customized chat box

We will follow this file tree

diretreee

Chatbox.php is the file which contains the main theme and chat box which will operate to show and receive messages from users.

Process.php , here is where the PHP code is present, which does the job of storing and retaining the chat data from the database.

Config.php , here we will store database configuration file.

Script.js, we will store all javascript and jQuery script.

style.css, we will store the css code for the chat box here.

Here is the code for the chatbox.php

 
[html]



Chatbox







[/html]

 

(To be Updated soon….)

 

Create your own WordPress theme from scratch [Part 4]

In previous tutorials we have coded header.php and content.php, now we shall code sidebar.php.

Sidebar is place where you can put widgets, or links or anything which is to be quickly available from every page in the blog/website.

WordPress has special feature to manage the sidebar, you just have to drag and drop the elements in the sidebar from dashboard, and that’s it, it will be live.

So, you have to choose what you want to put in side bar. Here am going to add search,categories, recent posts, archives, and web links.

Before doing that we must first register our sidebar, to do that we must first create a file named functions.php and add this code to it.

Continue reading Create your own WordPress theme from scratch [Part 4]

Create A Very Advanced Image Gallery With Only Few Lines Of Codes With PHP, HTML, CSS

You want to create a Web image gallery and don’t want to write repetitive code? then here is simple script, place it in a directory and also images in same directory under a folder called “images” and that’t it. It will list and display images itself. Not only that, it names the images from the file name, all you to do is rename images to the requirement.

Image gallery script

Here is the code

Continue reading Create A Very Advanced Image Gallery With Only Few Lines Of Codes With PHP, HTML, CSS

[How to] Store and Display images from MySQL using PHP

Now everything is database driven and people are willing to involve the db technology everywhere. So, lets see what we can do to throw a image on the screen not directly from the directory, where it is stored as it is. But, we will see how we can store the image in DB and display images from db.

As we are going to do it, I want to tell you what are the procedures involved in it.

First, we will read the images in the binary mode(Binary mode because it can represent anything) using a PHP script, and all the binary code will be stored in the database as is.

Next, we will give the name or number to those data for the identification.

And at last, we will create a script which will access the db, read the data into it, and display image.

Sounds simple isn’t it? Here create a table named imagedb

Now lets create a page called ” store.php ” because it the page we will use to read the images, and store it in DB.

The code we will add to it are

Save the file, and now create a new file called “images.php” and add this code below. this is the page which will fetch us image from the DB.

$data = $sth->fetchAll();
echo $data;

Now type the url http://localhost/path/to/image.php?id=id_u_used , tadaaa, you can see the image.

if you want to put your images somewhere, just use

<img src=”image.php?id=image_id” />

Generate a simple line graph with Pure PHP

You might want to generate a dynamic line graph to show some statistics, you don’t want to involve yourself into lot of tricky programming? Then let’s just use the PHP GD and Image Functions to do it.

Open a PHP page and add this code:

[php]

header(“Content-Type: image/png”); //this will set header as png image

$im = @imagecreate(800 , 600) //this is size of the canvas

or die(“Cannot Initialize new GD image stream”);

$background_color = imagecolorallocate($im,255 ,255 ,255); //background color as white
$black = imagecolorallocate($im, 0, 0,0);

imageline($im, 80 ,480,650,480, $black); //this for x-axis
imageline($im, 100,40,100,500, $black); //this for y-axis

//division on x-axis
$x_add = 50;
for($i = 0; $i <= 9 ; $i++){
imageline($im, 150+($i*$x_add), 480, 150+($i*$x_add) , 500, $black);
}

//division on y-axis
$y_add = 40;
for($i = 0; $i <= 10 ; $i++){
imageline($im, 80, 480-($i*$y_add), 100 , 480-($i*$y_add), $black);
}

$names_on_x_axis = array(1,2,3,4,5,6,7,8,9,10); // here is where you put the names for values on x-axis
$values_on_x_axis = array(1,2,30,4,5,50,7,8,9,10 ); //put the corresponding value
$y_axis_initial = 1; // here is where you put initial value for y-axis
$y_axis_interval = 10; // here is where you put needed interval value for y-axis

//write values on x – axis,
for($i = 0; $i <= 9 ; $i++){
imagettftext($im, 12,270, 148+($i*$x_add) , 508, $black, ‘font.otf’,$names_on_x_axis[$i] );
}

//write values on y-axis
for($i = 1; $i <= 10 ; $i++){
imagettftext($im, 12,0, 50 , 485-($i*$y_add), $black, ‘font.otf’,$y_axis_initial + (($i*$y_axis_interval)-1) );
}

//calculation part
$total_height = $y_add * 10; //height of graph

//this function will calculate the height for the points
function needed_height($input_value){
global $total_height, $y_add , $y_axis_interval ;
return 480-(($input_value/$y_axis_interval)*$y_add);}

//now to draw line graph
for($v = 2 ;$v<=10 ; $v++)
imageline($im,148+(($v-2)*$x_add),(needed_height($values_on_x_axis[$v-2])),148+((($v-2)+1)*$x_add),(needed_height($values_on_x_axis[$v-1])),$black);

imagepng($im);
imagedestroy($im);

[/php]

and save this page.

You can change values and names for the values by changing the values in arrays named “$names_on_x_axis” and “$values_on_x_axis“,

to change y-axis interval and values edit “$y_axis_initial” “$y_axis_interval“.

Beginers! step into advanced level programming.

Have you just completed basic programming? you can create simple programs? that is not enough, world expects experts. So, don”t stop at that level, you got to push yourself to next level, start programming more advanced and complicated things. Improve your coding standards.

How do you do that? Here are somethings you can do to improve yourselves with coding.

DRY programming

DRY(Do not repeat yourself) programming. This method means that you must avoid writing the same code over and over again. This reduces the file size and also increase standard, performance, readability, and adaption of the program. This is the one thing that will make you look very professional.

How to do this? well, you must start learning functions and OOP(Object-oriented-programming) programming. This will help you to avoid the repetition of code.

Maintain neatness

Neatness is one thing most needed in programming to make others understand what you have done. It will be impossible to other to trace your steps of the program, not only others maybe also for you, if you don”t maintain neatness and organization.

If possible, leave comments, it won”t eat much space!!! . Comments help others and you to know what that certain part of code does in the program, it will be of a lot of help if it is a big program, it will be easy to get back to coding without checking hundreds of lines and your personal dairy.

Use frameworks, plug-ins, external libraries

You don”t have to write everything from zero, there are people who are willing casino online to give you their works for free to use. All you have to do is edit it according to your needs and add some of your lines, that”s all.

Frameworks, these are programs or scripts which are meant to be linked to your code. When you link them, they have already written function which you can access easily in your code. They ease the coding  processor and also have performance optimizers. If you are not to approach OOP, then this would be a fine solution.

Plug-ins, plugins are same as the framework but it is a simple single function, it does only one or some related things. It is also linked to your program and accessed.

External libraries, these are libraries for programming languages. These are are directly inserted into programming language. when you think your programming language doesn”t have certain abilities then you must find libraries for it.

 

C program to Shutdown Windows 7

This C program will prompt to shut the computer as soon as executed.

Start C/C++ Programming.

C/C++ are in demand programming language these days. Though it is a very old invention, it is still being used and it has a big base. These days people like to program for hobbies and they build their own softwares for their purposes, You can do too. It is easy to learn and use and it available for totally free.

First Download The IDE(Integrated Development Environment), Why IDE? well IDE are powerful softwares for the programmers with built in automation tools which will reduce you job and increase the functionalities. It has built-in Code editor, compiler, so you wont be dependent on individual softwares for such needs. It has GUI( Graphical User Interface).

So there are Many IDE for C/C++ but the three major IDE’s of all are Eclipse, NetBeans and CODE::BLOCKS, of these all I use CODE::BLOCKS ’cause its easy to use and has simple UI, it depends upon you which one you choose, NetBeans and Eclipse are major and outgrown IDE on the stage.

Eclipse IDE Download.

eclipse IDE
Download Eclipse IDE for C/C++ Developers Here.

Download The Right version for your Computer.

NetBeans IDE DownloadNetBeans IDEThere are many Versions available to download.choose the right version or  Click here for direct download.


Code::Blocks Download.

CODE::BLOCKSCODE::Blocks
Download the Code::Blocks with mingw(A c++ compiler) it is need to have inbuilt compilation function.