Posts in category PHP
Useful PHP Snippets
PHP is the most widely used language when it comes to server-side programming. If you are a beginner or an advanced programmer and you use it in your work – our article will be very useful for you. Because today I want to bring to your attention a small collection of quite interesting and useful php snippets. They are designed as finished functions, and you can easily transfer them in a class or a library file for later use in your projects.
Coding conventions in web development
Today I would like to share with you a grain of my experience and we’ll talk about coding conventions. Every person who writes code for a long time, somehow comes to the question of standardization of the writing style of the code. I think that each of you have already faced the fact that different projects can be written using different rules and styles, and sometimes it’s annoying, and you want some standardization. In other words, coding conventions are a set of guidelines and rules for a certain programming language that recommend programming style, methods and practices for each case of a piece script written in that language. These conventions usually cover such aspects like comments, folders and files organization, indentation, declarations, white space, naming conventions, programming practices and principles, architectural best practices, and so on. We advise you to follow these rules when you write code, it will help to improve the readability of your code and make maintenance easier.
PHP AJAX Calendar
The calendar is an integral part of many websites, frequently, this is one of numerous jQuery calendar plugins, but it can also be implemented using php. Today I will show you how to create a monthly calendar with the ability to scroll (left and right arrows) through the months using AJAX technology. Besides of ajax, this calendar has another important advantage, it is mobile-ready calendar with the responsive layout. Before we start writing code, I recommend that you look at our demo to see what we’re going to do.
Learning Foreign Words
Do you think that learning new foreign words is tedious? Each of us could face with learning of new languages. Sure, it can be tiresome especially if you try to remember a plenty of new words at once. But what if to memorize words sequentially, one by one? I believe that this is one of good solutions. I prepared a simple but at the same time efficient script that will help you in learning new words. This script takes a list of new words, and turns it into a slider where you have to guess if you know the word or not. If you are uncertain of the word – press the button ‘I know’, otherwise – just skip the word. We also can finish the test or do hint.
PHP Debugging and Profiling – Xdebug
When we are talking about web development, PHP surely one of the most popular languages in the world. Its popularity can be judged from the fact that all the major CMS solutions available are powered by PHP. However for long PHP developers faced a problem in absence of a suitable debugger which other programming languages such as Java and C# enjoyed. Overcoming this meant manually adding debug statements which was quite a challenging task. This problem was solved once Xdebug hit the scenes and soon became one of the most popular PHP extensions.
How to create Pinterest-like script – step 6
Several our readers asked us to implement an infinite scroll for our Pinterest script, thus I decided to implement it today. I made some research, and came to http://www.infinite-scroll.com/. I think that the library is ideal for the realization of our objectives. It let us make some kind of endless pages. It means that initially we can render a certain amount of images, when we want to see more images, we can easily scroll down, and new set of images will be loaded ajaxy. If you are ready – let’s start.
Highcharts – deeper practice for real statistics
Everyone of us can face with a situation, when we need to handle with some statistics. Me too, I was going to make a short review on how to build active charts (diagrams), and in the long run I built quite actual statistical graphs, which initially are presented as CSV files. I found this statistics here, where I chose a couple of interesting tables: Marital Status and Educational Attainment. I developed the script that is able to select data from one or even multiple tables (of a CSV file), drawing various graphs for analyzing. In today’s article I will show you an interesting method of parsing CSV files, and displays the results in graphs using Highcharts.
How to create Pinterest-like script – step 5
Today – the first article in 2013. We are about to finish our Pinterest like script. In our fifth lesson I prepared next things: like and repin functionality and search. As you know, ‘like’ is a kind of a rating system. In our script – any logged member can rate any certain photo (to like it) once a hour (it is a protection system against cheating). If you like a photo and want to add it to your profile – you can click ‘repin’ button. This will add a copy of this photo for you (actually – only a new record to database). As for the search – everything is easy: we prepared this search bar long ago, but it has not worked before. I added this functionality today. We are going to publish updated sources of our script in our lesson. If you are ready – let’s start.
How to create Pinterest-like script – step 4
Welcome our friends and sorry for the delay, I had to do a lot of things in real life. But in any case, I am glad to give you our fourth lesson where we create our own Pinterest like script. Today I added the ajaxy comment system and profile pages here. We can now write our own comments (this is available for logged users) directly on our pins, or on larger versions (popups)of images as well.
Today I will publish all updated files of our script, in case if you want to investigate it at your local computer – you always can download full package with sources.