Showing posts from the "PHP" category

  • Backup Gitlab data locally

    I've recently moved all of my git repositories to Gitlab, this blog post walks through a script I have written to clone all of my repositories locally as a backup.

  • Export Locko to 1Password

    I recently changed password managers going from Locko, created by Binary Nights to 1Password from Agile Bits. Most password managers offer an Export/Import options (normally JSON being the file type of choice) however, Locko does not - and only exports its own format. I have written a simple bit of PHP

  • PHP Classes - Explained

    To put it very simply, a PHP class is a way of grouping a set of functions and variables into entities,allowing them to be used as self-contained instances . It is often described as the "cookie cutter". They are the groundwork behind object oriented programming. Once a class is in use

  • Wordpress - Pulling An Archive

    Image from The Digital Delusion As I mentioned in my first post I have made an archive of my previous Wordpress blog posts into a static page. This is done through some SQL and PHP. note: There may be better ways to do this - I am not a back end developer Wordpress is

  • #PHPFED - Variables

    Before you continue - make sure you understand the story. The next thing is that php lines always need to end with a semi-colon (;). This tells php that the line has finished and to run it. Without this you will experience 'Unexpected' errors. So lets get started. In a line -

  • #PHPFED - Includes

    Before you continue - make sure you understand the story. When developing static sites (i.e. sites without any sort of CMS - be it Wordpress, Drupal etc.) the PHP I find the most valuable  is the include. This allows you to include one file into another file. The file that you include can

  • PHP for Front-End Devs: The Story

    Recently, a few friends of mine have been asking questions about PHP and want to learn the basics. I am a front-end developer for a web design agency. i.e. I mainly stick to HTML/CSS and have colleagues who do the heavy PHP stuff. However, I think its handy for a

  • Limit Items (e.g. News posts)

    If you would like to limit the amount of items coming out of an array (for example the first 5 news items), then before your loop (e.g. while), specify your start and finish points $A = array_slice($A, START, END); while $A { For example, if you did want to only pull out the

  • Get an 'Even' Class

    This  PHP statement applies class="even" to every other element when in a loop. Since this post was originally created, CSS has somewhat evolved, allowing you to do div:nth-child(even) to style every other element I often use this on tables to get an even class to help divide up the rows, but it

  • Giving something a 'Last' Class

    If you want to apply a different class to the last item in a list generated by PHP, start off with Setting the $lastOne variable to the end of your list <?php $lastOne = end($your_array); This stores the details of the last one in your list into the lastOne