Author Archive

Code Igniter and Smarty Template Engine

Earlier today I decided to spend some time looking at new ways to improve Code Igniter’s template code. I’ve been using Code Igniter for about a year now and I’ve always been a little frustrated with how it’s template code can get a little out of hand. Sure, PHP has a shorthand syntax but it can still get a little messy without a lot of self discipline. Now I could blame myself and my sometimes undisciplined coding habits, but I’d rather blame my tools and look for a better way, which is why we aren’t all still coding in the 8086 assembly language.

So since then, I’ve been on the constant lookout for better ways to structure the template code. I’ve been coding professionally now for a good 10 years and I’ve still not seen a better way to seperate out PHP code from frontend code than by using Smarty.

I started using Smarty in 2005. It’s the most popular PHP template engine and sports it’s own template language. If you’re a PHP developer and you’ve never checked it out, you should take a look. You’ll have to go through the hassle of learning it’s own templating language, but once you’ve done it, you’ll see how much simpler your frontend code can be. In fact, I’ve never managed to find a better way to write it, which is why I started looking for ways to improve Code Igniter’s frontend code, and you’ll never guess what I found. It turns out that I can have my cake and eat it, I can use Smarty with Code Igniter!

I stumbled upon this excellent tutorial, written by coolphptools.com where it shows step by step exactly how you can get the two of them working together. So, I followed it, and made some small improvements along the way.

I won’t repeat what the tutorial covers, you can check it out if you want to go through the steps yourself, but if you just want to try it out, then you can download my working copy of Code Igniter and Smarty.

I used Code Igniter version. 2.0.3 and Smarty Template Engine version 3.1.4 along with the bridging code provided on coolphptools.com. In my environment I used PHP version 5.3.5 running on Apache 2.2.17. It’s also worth noting that  Smarty v.3 is not backwards compatible with PHP 4.x so if you haven’t updated to PHP 5.x by now, you should.

I made two slight amendments to the steps outlined in the tutorial.

Template Code Delimiters

I changed the left and right template code delimiters from the standard curly brackets to a combination of tildes and square brackets. If you write a lot of Javascript and embed it in the template files then the default code delimiters in Smarty can cause a few issues…

So with my new change {smarty_variable} becomes [~smarty_variable~].

It’s a little more verbose, but gets around having to use {literal} tags everytime you need to add Javascript in your .tpl files.

Error Reporting Level

By default in Smarty 3, template error level reporting is not used. Instead Smarty uses the global error reporting defined by PHP. As many Smarty templates use code such as:

<snippet>
[~ if $message ~] Please complete the form. [~ /if ~]
</snippet>

… then in times when $message is not defined and PHP is set to throw an error on a Notice then this
code will display an error. As this code is very common, particularly in legacy .tpl files, I amended
the Smarty.php file again to not throw notices on errors in the Smarty templates.

If you haven’t tried out this combination, then this should help you get started easily. It’s a great combination that combines the power and structure of Code Igniter with the simplicity of Smarty in the view.

Download the Code Igniter and Smarty Package.

UPDATE: I’ve put the code up on Github: https://github.com/iarfhlaith/Code-Igniter-and-Smarty

The End of Local Business

The sky resembling a planet as seen from space.

I was shopping in Trespass in Dun Laoghaire Shopping Centre last weekend. It’s an outdoor adventure store just like The Great Outdoors, except it’s family run. As I was taking my change at the till the store owner thanked me for “shopping locally”. Not unusual in itself, but it really got me thinking about how the notion of shopping locally is dying.

It’s a lovely thought, but unfortunately the truth is that many business who continue to think locally are suffering, and things will continue to get worse for them until they start to think bigger.

The Web is changing everything and all businesses, including yours needs to recognise this, learn about it, think of the changes they need to make and then act accordingly.

Thinking globally needs to be at the core of your business strategy, because simply put, it’s at the core of your competitors’. And your competitors aren’t just down the road anymore, they’re everywhere. They’re all across the country, throughout the EU, in the US, and you can be sure that they’ll be opening in China in no time at all.

Competition used to be a geographic problem. You competed with businesses in your area and those that operated elsewhere weren’t a threat. They sold to a different market. But the web changes things. It breaks down the walls and allows your competitors from all over the world to sell to your customers and take them off you from right under your nose.

The only way you can compete is to start thinking as big as they are, and that means selling online. Whether it’s software or sportswear, you’re new market is a global one, which let’s face it, is a really really great thing. But it comes with one caveat, and it’s a huge one.

When you sell globally, you need to be the best in the world at whatever it is you do. Think about that. It’s a game changer. You won’t get business anymore simply by being convenient for your customer. Your shoppers are online, every online store is convenient for them. The next. They can just as easily buy from an overseas wholesaler in Dalian, China. The only way to appeal to them is by being better then the competition. In different industries that means different things. Mostly it’s about getting the basics right. Providing great value, incredible customer service, delivering on time and generally making your customers happy.

The phenomenon of the Web means that anyone can compete globally. It’s a massive opportunity. There are loads of amazing books covering this topic (checkout Tribes, Crush It and Rework), but my main point here is that the easiest way to compete globally is to pick a niche. Big plays are risky because you’re competing with the big boys in those spaces. Taking on the Google’s and Amazon’s of this world sounds risky. Better to pick a niche. That way you can absolutely kill it without having to compete against established businesses with more money than sense.

If I was the owner of Trespass, I’d be looking at ways to bring my business further online. Then beyond that I’d be looking at ways to differentiate myself from other outdoor adventure stores. Being so close to two prestigious sailing clubs (The Royal St. George and The Royal Irish Yacht Club) perhaps they could reposition themselves as the absolute authority on sailing equipment and clothing? They could setup a new online store selling just sailing gear. They could blog about the Volvo Ocean Race, and other huge sailing competitions, they could start commenting on the gear that the professionals are wearing on each race and then offer links to their website where that same gear could be purchased. The options are endless.

That’s scary, it’s different and it’s risky. It’ll completely change their business model. Sure they’ll still be an outdoor adventure store, but they’ll be selling globally instead of locally, and if a local customer does happen to buy from them at least they’ll still have their doors open in years to come so they can still say ‘thanks for shopping locally’ every now and again.

 

Image Source:  Bordered by the entrance to the North Hollywood Metro station, the sky resembles a planet as seen from space in this Aug. 22 photo by Romeo Doneza.

Introducing – TheDebs.ie

Most of the time when I introduce a new app or website it’s usually to promote a hair-brained idea I’ve had. Some flight of fancy that I’ve been working on in my spare time. I’m usually so excited by whatever the crazy idea is that I charge straight past the sensible pre-production steps such as market research, feasibility, finance, and competitive analysis. I forget to do any proper research or preparation and I go straight out and start building. I hack away at it for a couple of weeks and then launch a teaser website just to see if there’s any interest. In short – many of my ideas are ill-considered, badly managed, and often never see the light of day. But – TheDebs.ie is different. It wasn’t my idea, it has been properly planned, the market research proves the demand, it’s fully financed, there are amazing people involved, and because of all this, I’m backing this project 100%.

TheDebs.ie is the result of 12 months hard work from Keelin Harty, my best friend in the whole world. As many of you know she’s incredibly special to me in so many ways and to see her take the leap into a web startup leaves me in absolute awe of her determination, focus, vision, passion and leadership. All of which she has channeled over the last year into an idea that’s letting her follow her dreams. As you can tell, I’m just bursting with pride so without any more fanfare let me introduce you to thedebs.ie.

TheDebs.ie is a web app built for Debs Committees to let them plan and book their debs online. It has been built specifically for Irish Debs Committees to help them book their hotel, select their menu, choose a photographer, a coach, a band, a DJ and even to have the night themed. Along with making the job of organising a debs easier, the app helps the committee to promote and sell the tickets to the event online.

Each feature has been carefully considered, researched, and built with the committee in mind. In co-operation with many 6th year students, Keelin has carefully worked through every possible need the committee may have to ensure that using thedebs.ie helps them spend less time managing such an important event and ensuring that their special night goes off without a hitch.

Along with benefits for the committee, the app also makes things easier for the hotel and other suppliers. It’s easy for them to accept new booking requests, get all the information they need, and get paid and the end of it all. And for students, it’s beneficial too as they can make payments online, stay informed on the progress of organising the debs and stay up to speed on what’s happening next.

The app becomes available to students in September at the start of the school year. In the mean time if you’re in business and you are looking to sell into the lucrative debs market, then please sign up under the right category and get your business listed on thedebs.ie. In particular if you’re a hotel owner, run a transport company, are a freelance photographer, play in a band, or work as a niteclub DJ, then get yourself listed on thedebs.ie as soon as possible.

A huge thanks to Michael Bradley at Mode.ie for his tireless hard work behind the scenes for the last 6 months, to Phil Brant for his instrumental help early in the project, and also to Luciano Jardim for creating so many beautiful designs in his limited spare time. You guys have been amazing – now it’s over to us to make it all worth while.

You’ll start to hear more and more about thedebs.ie in the coming months and there are a few more surprises planned along the way too.

This isn’t a hair brained idea or a crazy flight of fancy. This is a real business with a real crack at something special. It solves a genuine problem and it does it beautifully. That’s why I’m supporting Keelin on this completely. Check out the website for more details, and don’t forget to tell any students you know who are going into 6th year this September. The Leaving Cert is stressful enough without having to worry about organising your school’s debs ball. TheDebs.ie makes that much easier. Let Keelin and her team help you, because that’s what she does best.

Launching 61 South – with Lifeline

Tonight at 61 South William Street myself and some friends are launching a new art gallery 61 South. We’re hosting the opening night of the Michael Kieran’s ‘Lifeline’ exhibition.

Lifeline is a rare opportunity to this very private artist’s  last decade of work in his first return exhibition to Ireland from France.

Produced over the last 10 years, this show is a very personal exploration with the artist, inside his influences and thoughts as he moved from a studio in Ireland to his atelier in France where he now resides.

Lifeline provides us with a rare glimpse into the change and affect that this has impressed on one artist.

The exhibition will open on Thursday, 9th of December at 61 South Gallery on South William Street, Dublin 2 at 7:00pm. It will run until Thursday, 23rd of December.

For more information visit www.mikekieran.com and www.61southgallery.com

Not All Meetings Are Toxic

Toxic Meetings

As some of you already know, I’ve launched a new business with some entrepreneurial friends called The Board. This is effectively a pseudo board of directors for your business made up of experienced business owners from non-competing, complimentary sectors. The Board meets every month to discuss current business issues, helping members make important decisions that can be implemented immediately to improve their business.

I passionately believe in the concept and have (hand on heart) benefited hugely from my own membership on The Board since it’s initial inception almost 18 months ago.

However, I am also a big follower of 37signals‘ business approach, who believe that meetings are toxic. If you haven’t heard of these guys before, take 5 minutes to read a few excerpts from their new book, called Rework, where they devote an entire chapter of the book to explain why meetings are toxic and should be avoided at all costs.

On a daily basis I rant and rave about 37signals’ approach to business, and on this point I agree with them that most meeting are toxic. However some meetings are necessary, even vital, to a businesses success.

So, I find myself in a position where the people that know me could potentially be confused by my apparent double stance on this issue. In this post, I want to address these two positions, and justify why I believe so passionately in both, despite the fact that they seem contradictory.

Toxic Meetings

Meetings become toxic when:

  • you don’t need to be there;
  • you have no power to make a decision at the meeting;
  • it’s outcome does not affect you;
  • your points of view are not considered;
  • there is no reason to hold the meeting in the first place;

If one or more of the above scenarios is true, then that meeting will be a waste of time for you and you should avoid it.

Productive Meetings

Meetings are awesome when:

  • you have a pressing issue that you need advice on;
  • you have the power to make a decision on the issue by yourself;
  • it’s outcome has the potential to have a massive impact on your personal and/or business life;
  • your own input into the meeting is valued and respected;
  • there is a strict agenda which steers the course of the meeting;

In these cases, meetings can be incredibly powerful. And if, when a meeting is called, all of these scenarios are true then it’s simply vital that you attend.

Another Reason Meetings Work

Most people live in their comfort zone. They go through their life keeping the status quo amongst their peers. Regardless of what social circle they’re in, most people will do whatever it takes, deliberately or not, to maintain that status quo.

Here’s an interesting fact:

If you take the salaries of all your friends, and then get the average, chances are, that’s what you earn.

That’s an amazingly powerful insight.

Most people are afraid of failure, but even more afraid of success. (more on this in another post soon) but suffice it to say that by becoming a success you are breaking the mould of your peers, and forcing change upon your own life, which can be very stressful and potentially lonely.

Most people can’t (or won’t) push themselves out of their comfort zone. A lot of people have blockages to their on success (myself included) and I see time and time again, cases where they sabotage their own potential because it means leaving their comfort zone. Again, I’ve done this to myself more times then I can remember. It’s something I’m working hard on improving.

Productive meetings work, because in them people are pushed outside of their comfort zone. They’re encouraged to make the right decision, not the easy decision. They’re given insights that they may have otherwise dismissed because of their own mental blocks or personal baggage.

After a really great meeting, people feel motivated, energised, determined and focused. And without the advice and encouragement from other participants of the meeting, I simply don’t think that’s possible.

Yes, some meetings are toxic. But we’re not all 37signals. Some of us need help getting past our issues (most of which I believe is a result of how we perceive the world, rather than how the world actually is – again, that’s for another post). For this we need the help of others who are willing to push us out of our comfort zones and onto the fast track (or the slow track, depending on what your goals are).

Yes, I’m a 37signals fanboi, but yes, I’m also a huge believer in productive meetings. The Board has helped me break through some very serious issues in the past. And I look forward having them help me make more decisions for years to come into the future.

Disclaimer: I am a co-founder and shareholder of The Board.