Posts Tagged 'PHP'
PHPCheck out all of the posts tagged with 'PHP' below. If you still can't find what you are looking for, try searching here
I wrote a post mid last year about protecting your site images from being hotlinked as I found a site that had word for word scrapped one of my blog posts, you can see the post here, and I really wanted to go back to this and run over a few more things the .htaccess file is useful for. I mainly use the .htaccess file to rewrite URIs for example http://mysite.com/site/pages/contact.php would be accessed by visiting http://mysite.com/contact. So the URI is being re-routed to …
I was set a challenge last week to complete a Rubik’s cube after tinkering with one by a colleagues desk and managing to get a complete line of matching colours with little effort. In the past i’ve never fully understood the concept and complexity of how to complete this popular 80’s puzzle. However the same way as a programmer I work out the right way to complete a coding issue by using a set of pointers and algorithms, the same is applies to completing the …
I’ve never really got the hang of PHP frameworks and have tended to use my own custom built CMS but even with this I still find myself writing the same code over and over again. In the past I’ve dabbled with CakePHP and the Zend Framework and not really got very far, so a few days ago I downloaded CodeIgniter. Although I’m extremely new to this I was pretty blown away by the simplicity of setting things up and getting an actual webpage that processes …
As the title describes we’re going to look at making cross domain ajax requests using JSONP I’m also going to show you how to get data from a MySQL database and encode it into a JSON string which can be parsed using JavaScript. JSON stands for JavaScript Object Notation and essentially its a method which allows us to execute cross domain ajax requests without too much fuss. This post really follows on from my article about scraping content from a page but also allows you …
I’ve had a few pagination scripts over the years but I thought i’d share the one that i’m currently using as it’s a useful script to have in your toolbox. As a developer you’ll soon find a need to paginate data when displaying contents from the database, and rather than use JavaScript which could require all the data to be loaded into the page on load, we can use PHP to ensure that we’re only requesting the data that we need from the database. For …
“Easy PHP Websites with the Zend Framework” shows you how to use the powerful Zend Framework to build websites with amazing speed and efficiency. Embracing a teaching strategy of learning by doing, showing you how to build website features you’ll actually want to use within your own websites. Among other topics you’ll learn how to manage data submitted through web forms, send e-mail through your website (both text and HTML), manage the user registration, login, and password recovery processes, and even create a simple social …
Its sometimes necessary as a developer to log and track data as it is processed either to debug or to keep a simple record of maybe who’s logged in or out of your site. You could easily do this by accessing a MySQL database and adding a row, but you then have to create and maintain that database. So today I’m going to run through the steps to writing and reading a .txt log file.
The Code
In order to write and access our log file we …
So we have content on another domain that we want to load via AJAX into a page how can we do this?…. This was a question that was put to the other day at work. More experienced web developers will know that JavaScript doesn’t allow cross domain XMLHttpRequest’s or AJAX requests (Asynchronous JavaScript and XML). There is a ‘dirty’ way to get around this using PHP and CURL to pull the HTML of the page you want to get the content from so JavaScript …
Inline editing as it’s known, or being able to edit content directly on a page is a great tool have under your belt. I’m going to run through exactly how it works as well as how to POST the updated text content through to a PHP script for server side processing to put in the database.
The Code
It looks a little complex so i’m going to quickly run through exactly what’s going on.
When you visit the demo page are presented with a block of text. …
I want to just start this little post with that fact that I don’t know all the ins and outs of using Memcache but I have enough knowledge to just about get it working. I have access to a Mediatemple Dedicated Virtual Extreme server and managed to install it on the server using SSH, with the help of this little guide from Mediatemple which runs you through the installation process step by step.
Who uses Memcache?
Well Memcache was developed by Danga Interactive to enhance the speed …
API Knowledge
A key tool for any budding web developer is API knowledge. It’s good to familiarise yourself with a variety of application interfaces. I started out using the Twitter REST API with PHP and CURL when twitter first launched the API to basically get a users tweets, pretty simple now I look back, but at the time it was the first time i’d done such a thing. As the development of social media continues this will increasingly open up opportunities to develop more and more …
Learning a new programming language can be daunting to say the least. I’ve recently cracked it when it comes to jQuery. I wouldn’t say Im a pro by any stretch of the imagination but I can successfully build applications. It wasn’t an easy ride learning a new syntax, I’m going to run over a few tips and techniques that i found useful learning both jQuery and PHP.
Take Time To Learn
In order to get into your new programming language you need time and commitment to perfect …
I wrote a post a while back when I purchased my iobridge module which you can use to control switched and sensor. After that post I had my module rigged up in my office at home just monitoring the room temperature and ambient light hourly, I wasn’t sure what i could do with this data at the time so using the Google Ajax API I displayed the data using 2 graphs purely as a bit of fun. Now i’ve decided to take it a stage …
In this tutorial we’re going to take an RSS feed from the top videos page on MySpace and make a widget to display the latest videos using jQuery pagination, ajax and a spot of PHP to parse the feed. The basic logic of what is going on is simple. We parse an XML file echo all the results, then we use the quick paginate plugin to display a select number of results with the option to browse pages.
Lets first take a look at the PHP …
Occasionally you may wish to make certain pages of your site only viewable to a select few. you can do this by using PHPs built in HTTP Authentication. The code needs to go right at the top of your php page so don’t get ‘Headers Already Sent’ errors. You can see that we’ve specified the username and password in the variables at the top of the script you can change these to reflect your own username and password.
You could easily make this authentication more dynamic …
Here’s a quick piece of code that i find useful to check if a request that comes to a PHP page was made via an Ajax call or a simple form post. This method uses the $_SERVER['HTTP_X_REQUESTED_WITH'] request to determine if data was sent to a specific page using an xmlhttprequest. It’s worth bearing in mind that there is no guarantee that every web server will provide this setting, servers may omit specific $_SERVER parameters, That said, a large number of these variables are …
I was reading Nettuts.com this week and saw the post by Matt Vickers on checking the availability of a username with Mootools. I tend not to use Mootools so i thought I’d replicate the technique using jQuery. The code degrades gracefully if JavaScript is disabled, it is advised that you always check the username against the database again, just before you add any data to the database.
The JavaScript
So to start with we have our jQuery on document ready function, within this we have an event …
Over the past few years I’ve had the opportunity to work on a few personal projects. This allowed me to experiment more with techniques that I wouldn’t have normally used on client sites. During this time I was building a blogging platform, I soon found that it was difficult to present the data and make it look interesting to the user, this is where i discovered web thumbnails to achieve this.
There are a variety of web thumbnail services out there but the best and easiest …
I’ve been working on a lot of JavaScript and PHP projects at work recently which is one of the reasons why I haven’t written a post for the last week. During my many projects i had the need to use an ‘autosuggest’ script that would, in my case, get a list of 10 schools based on the users input in a text field. I thought I’d share this with you as it’s probably easier than you think to do with JavaScript.
Lets run through the JavaScript.
There …
Continuing with a rather ‘Ajax’ theme after the last few tutorials on here i thought I’d go the full way and show you how to create a 140 character php and ajax comments tool. We’re using jQuery to perform the ajax request and create the user experience. You can download all the files needed to get this working at the bottom of this post, it includes the MySQL file to create the database table.
The Code
The document ready function adds and removes the text ‘Leave …





