WordPress – Shortcode in PHP files

So in WordPress with plugins etc. you end up using shortcode in posts to keep things simple, an example would be if you want to display a gallery you would just use:

[galleries id="1"]

However trying to this when your outside of the “WordPress Loop” (in your theme files usually) you will hit the problem that WordPress won’t parse the shortcode.

The solution is very simple, just append the following to your shortcode:

echo apply_filters('the_content', '[galleries id="1"]');

And it works!

To read up more on shortcodes in WordPress click here .

Posted on September 11, 2011

Why I am learning Perl


So this post may not be to everyone’s taste, its more a post to remind myself why I’ve decided to learn Perl. If anyone doesn’t know I already know PHP and Java.

Perl is a programming language, It’s Object Oriented, simple to learn and very powerful. Perl stands for: “Practical Extraction and Reporting Language” but others have come up with many more interesting and colorful names for it;

Perl is “the little language that could” it’s designed to be able to do as many tasks as possible in as little time as possible.

“A good perl program is one that gets the job done before your boss fires you.” Larry Wall, the creator of Perl.

Perl is an Interpreted language, so you don’t have to compile it like you do Java, C, C++ etc. For fast development work, that’s a godsend.

Perl has been successfully used for a lot of diverse tasks: text processing, system administration, web programming, web automation, GUI programming, games programming, code generation, bio-informatics and genealogical research, lingual and etymological research, number crunching, and testing and quality assurance.

Perl Pros

  • Cross Platform compatibility. A perl script for linux/unix will work just as well in windows and vice versa, and the only exceptions to that rule are those dictated by the operating system itself. (for example file paths are different in windows and unix.)
  • Online support. Perl has been around since the early 90’s, its exceptionally well known and thousands of tutorial and help sites abound on the internet.
  • CPAN.org, a massive collection of perl modules that can do almost anything, someone has usually done the work for you.
  • Taint mode, this helps you to write secure code by not trusting any data provided by the users until you have tested and declared it safe.

Perl Cons

  • Speed. Apparently with a very large program (Like word or something) the sheer size of it would make it extremely slow to compile at runtime.. This is the only Con I’ve found about Perl!

Posted on August 19, 2011

PyroCMS – CMS on the CodeIgnitor Framework

Update as of August 2020 - PyroCMS now relies upon Laravel.


So lately I’ve been playing around with PyroCMS , for any of you who don’t know about Pyro, its basically an open source content management solution that iss based on the CodeIgnitor framework. What does that mean you ask?

  • MVC design pattern. (Model->View->Controller)
  • Security, Cross-Site Request Forgery protection, XSS filtering and very secure password encryption.
  • Caching, in order to achieve maximum performance.
  • Translated into 16 languages!
  • Extremely lightweight!
  • Support for modules, themes, plugins and widgets!
  • Multi – Site Manager (In Pro Version £45 )

Really it takes the pain out of making your standard websites, you’ll have an area where the client can update their website in a simple environment and thanks to ‘permissions’ you can be sure they won’t mess anything up!

Of course there is always going to be a stage when your better off without a framework, but for projects that it will work for, PyroCMS will save you a BUNCH of time!

Posted on August 14, 2011

Esprimo Mobile v5535 and Ubuntu 10.10


So I ended up picking up a cheap Esprimo Mobile v5535 a few days ago, long story short; laptop broke, Argos have sent it off for repairs that will take 2-3 weeks, that’s the last time I buy a laptop from Argos.

Anyway the Esprimo Mobile isn’t exactly a cutting edge laptop, if you said it was outdated you wouldn’t be wrong. When I got it the OS installed was Windows Vista, “ambitious” I thought, of course I can’t have any kind of computer without tinkering with it endlessly to find out the best way performance wise for it to be running, Ubuntu was in my head from the start but an apparently broken CD-drive was putting an end to that.. I’ve never tried to install Ubuntu from a network and I wasn’t going to start now, (USB wasn’t an option in boot) instructions on Ubuntu’s Support don’t make a network install look simple!

A few Registry edits later, (one too many in-fact) I had the CD-drive working but Windows locked in that state of “somethings missing, would you like to use Startup Repair?” and then when using Startup repair just rebooting the computer into the same cycle. No worries though at this stage I just began installation of Ubuntu. I was surprised to see that the Wi-Fi worked from the get-go, is nDiswrapper ever needed any more? 😛 The only issue was the resolution seemed to go no higher than 800×600.. Of course a few google searches later and I found this article which explains how to install the drivers for SiS Graphics.

Using their default Xorg.conf and driver I rebooted only to find the machine now screwed graphic wise, lines all down the screen changing.. I originally thought it was the refresh rate but hell this is Linux, you could set every setting to the absolute worst one possible and still be able to change back, where is that option Windows? So I switched to a terminal window (Ctrl + Shift + F5 (any F key) for those interested) opened up Xorg.conf and using sudo nano changed what seemed to be affecting the graphics; Option "UseTiming1366" "yes" to Option "UseTiming1366" "no" (didn’t know yet if it was the problem) rebooted and finally got a 1280×800 resolution!

So the point of this story is; It’s great how in Linux you’ll mess something up and still be able to repair it via a terminal window, and if you need better resolution on your Esprimo Mobile click this link .

Posted on February 04, 2011

Installing PEAR in WAMP


So this evening I went about attempting to install PEAR on my WAMP installation, this should be as simple as opening up a command window navigating to C:/wamp/bin/php/*phpversion* and running go-pear.bat, however upon doing this I ran into the following errors:

phar “C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar” does not have a signature
PHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error:
invalid url or non-existent phar “phar://go-pear.phar/index.php” in C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar on line 1236
Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error:
invalid url or non-existent phar “phar://go-pear.phar/index.php” in C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar on line 1236
Press any key to continue . . .

A couple of Google searches later I got the answer needed to fix my problem, simply running this command instead:

php -d phar.require_hash=0 PEAR/go-pear.phar

A couple of questions later PEAR was successfully installed and running, so if your running into the above error you now know what to do!

Posted on December 27, 2010