Papermashup

Latest Posts


Subscribe


Tweets


"@KBedders @elerichardson I'm Free!!!!!! Call / Whatsapp me!!!"

@ashleyford 1 week ago

"@KBedders moomin!"

@ashleyford 2 weeks ago
Papermashup

PHP

PHP array to CSV Function

Sometimes we need to export and convert data from a database into a CSV format that can be downloaded and manipulated for other purposes. This function will loop through the multi dimensional array and convert the data to CSV format and output the download to the browser forcing the headers to download the file. The Code

AshleyAshley

PHP Clever Caching

This clever bit of code checks if a page has been modified since it was last displayed and if it hasn’t, it sends a “304 not modified” header and exits, otherwise the content is loads as normal. Add the code below to the top of each PHP page you want to apply it to. It’s especially useful if you serve static content [...]

AshleyAshley

Show Google Plus’s – PHP function

Following on from yesterdays function to get likes and share data for a URL here’s a function to get Google Plus’s for any URL. The Code It’s worth pointing out you must have CURL enabled on your web server, I believe it’s enabled by default on PHP5 setups. Also the Key below Isn’t a unique API key you must leave [...]

AshleyAshley

Display Facebook likes / Shares PHP function

We launched a new product at Harkable last week called Daily Pulse – which tracks social data for any URL, you can also subscribe to receive email reports. I thought i’d share a bit of functionality similar to how we engineer Daily Pulse. The Code Below is a super simple function that retrieves a JSON feed of comments, likes and [...]

AshleyAshley

6 Useful PHP code snippets

Here’s a selection of really useful PHP code snippets that I find using on a weekly basis. You could use these as is or expand them as part of other applications or add them to a php class. Adjust server time If you have a server in a different timezone to you then you might be seeing funny things happen when you add the time to a MySQL [...]

AshleyAshley

Display breadcrumbs on your site using PHP

When you have a fully dynamic site it’s useful to show the user where they are by breaking down the URL structure so they can navigate backwards through the site. For example this url: http://papermashup.com/categories/jquery/ shows that ‘jquery’ is part of  ‘categories’ so the user could navigate backwards through [...]

AshleyAshley