Lonnie Ezell

Web Mechanic, Author, Musician

Basic CodeIgniter Templates

One of the most requested features for CodeIgniter Reactor is better template and theme support. The more I think about this, the more I find this to be an unnecessary addition to the core. Don’t get me wrong, I love the idea of a full-featured template/theme library. Heck, I even made my own. But everything you need to do this is already there in the form of $this->load->view().

A template is simply a wrapper file that includes common features, like a header and footer, and maybe a sidebar. Here’s a quick run-down on how to make it work for you.

The Basic Template

<!doctype html>
<html lang="en">
<head>
<title>My Site</title>
</head>
<body>
<?php echo isset($body) ? $body : ''; ?>
</body>
</html>

Assuming that file is in views/layouts/main.php all you need to do is:

$data = array(
    'body' => $this->load->view('my_view', null, true)
);
$this->load->view('layouts/main', $data);

There’s nothing magical about it. It’s about as simple as can be. You can extend by separating multiple view partials (like the header, footer, etc) in separate view files and include those in each layout, if you need multiple layouts to share common elements.

The one thing to keep in mind is that CodeIgniter was designed for high-performance. Every file you read off of the disk, the slower your app will perform (unless some form of caching is used.)

CodeIgniter doesn’t need a template feature. It just needs good docs on a few of the myriad ways to handle templating using the built-in commands.

Introducing: Forensics Profiling for CodeIgniter

You program in PHP with CodeIgniter? Then I’ve got something to make your life easier when it comes to debugging and QA on your code. Introducing: Forensics Profiler for CodeIgniter.

CodeIgniter Forensics

This is a replacement of the existing Profiler included in that includes:

  • Completely customizable output.
  • Skinned to reflect the inspiration: ParticleTree’s PHP Quick Profiler.
  • Shows all files included during the page’s execution.
  • Adds a new Console static class that gives you the ability to log items to the console tab of the new profiler bar.

It can be a great time-saver while you’re debugging your application.

Please head over to the GitHub project page for the Forensics CodeIgniter Profiler and start saving yourself some debugging headaches today.

Got Ideas? Leave a comment. I’d love to hear them!

Plotting A Novel Backwards

It smacks you in the head while you’re driving to work. Another idea for your next Great Novel. All day long, it simmers in the back of your mind and you know the broad-stroke basics. You have a rough idea of who the main character is, you know what dire situation they will find themselves in. You might even know how the win they day. You rush home, suffer through dinner with the family while trying not to lose the great novel idea. When you finally get your chance, basking in the glow of the computer monitor, you freeze. What the hell actually happens in this story?

This is common. Heck, I’ve struggled with it for the last couple of years with my sequel to Daughter of the Sun. And then I remembered something that makes it all so much easier. Plotting your novel backwards is so much easier! And effective. I treat it as the first draft of my outline (though I hesitate to use that word.)

Here’s how it works:

1) You decide who your main character is and what pickle they’ve found themselves in. This should work from either a character or event type of story. Idea stories probably are workable here, too, but milieu stories (ones where the setting is most important) might be more difficult.
2) Come up with a way that they ultimately defeat that story. What is that they have to resolve to make the story come to a climax? That’s your ending. OK. Probably not the very end of the story, but close. You might need to wrap up some loose ends after.
3) (This is the fun part!) Ask yourself, “What has to happen to bring us to this point in the story?” And keep asking yourself this over and over, until you have a chain of events (however unlikely) that lead you back to the beginning of the story.

There you go. A rough draft of your story’s outline. Easy, huh?

If you’re like me, you sometimes get stuck trying to push your way through the story, trying to plot the novel from the beginning forward. Maybe you have a few ideas that are candybar scenes, and you try to meet up with them in the middle somewhere. Or maybe you’ve taken a more rigid approach and try to work out what has to happen at plot points 1-22, but you keep getting stuck.

Here’s my advice. Try plotting your novel backwards first. Fill in the blanks as to what HAS to happen to move the story along. Once you have a rough draft outline done, you can use all of the story theory you want to check that things actually work. More than likely, you’ll have many new ideas that need to be fit into your novel’s shiny new outline. You’ll probably even have thought of different ways that you can get from the end of your novel to the beginning.

But that’s OK. At least you have a framework to build from. You have pieces you can rearrange.

And no more staring at the blank page.

Writing Fiction – The Zone

Writing Fiction 01 – The Zone

This is the first in a series of articles looking at the essential things that all fiction writers need to develop. Some, like this first article, will be more about the attitude. Others will dive straight into practical tools. Each article will touch on why I believe they’re effective, and why you should use them. None of these are gospel. Take what works, mull it over, and try different variations until you find what works for you.

Writing in the Zone

I love Dean Koontz’s stories. Lately, though, I’ve begun to realize what his stories are missing. Energy. The plotting is exquisite. The language often beautiful. It’s the plot and the characters only that pull me along for the ride.

“Now wait just a cotton-picking minute, Lonnie,” I hear you yelling at your screen. (By the way, exactly how long is that, anyway?) “That’s what everyone’s preaching: characters and plot, characters and plot.” Yup. They sure are. Are they wrong? No. Absolutely not. Without those 2 things, you cannot have a good story. But if you want a good novel, I think you need more.

“What’s the difference between a story and a novel?”

A story is what happens, who it happens to, how bad it gets. A good novel is a story that makes you keep turning the pages when you know you should be studying, or sleeping. A good story can have fantastic moments and ideas that you spout off to your friends afterword saying things like, “Dude! That was such a frickin’ cool plot twist!” A good novel can suck you in for an entire weekend, refusing to let you go.

I read somewhere a long time ago that Dean Koontz just may be OCD. That he will write the first page, then go back and edit it somewhere between 9 and 15 times until he thinks everything is perfect. Then he writes page two. I don’t know if that’s true or not, but if you pay attention to his writing style, it fits. That perfection, I believe, is also what kills the energy of the book. Like I said, the stories are great, but I don’t find myself getting sucked into them. Granted, I could be getting on in age, also, but I don’t think that’s it.

“Why should we strive for that if Koontz is making millions and living in a 19,000 square foot house.”

First – because you’re not Koontz, and you don’t have a built-in audience that will buy anything you write, for life.

The second reason is the biggie. The one that really matters, in so many ways. Yet it boils down to the fact that your story-telling will be better for it. Let me explain why I think that’s true.

You’ve heard of the difference between the conscious and the non-conscious, right? The first is what you use to actually think with, the second is what does everything else. The non-conscious is an absolutely amazing creature. Every second, it processes over four hundred billion bits of information, but our conscious mind is only aware of two thousand of those. 400,000,000,000! It records everything we hear, say, see, smell, feel, and intuit. Then it files it away in a complex set of files that are all linked and interlinked by–get this–emotion.

You’re probably asking yourself what this has to do with writing. One word for you: everything.

What do you think gives a story that energy, that power, that I mentioned before? That’s right: emotion. If you can train yourself to be in what athletes call the Zone while you’re writing, I guarantee that energy and emotion will shine through in your writing. The passion for your story will overcome all of the doubts that we all suffer from, and will help you write clearer, stronger, more emotional stories.

“All right. I’m intrigued. How can I find the Zone?”

While there are a couple of things you can do to help yourself into the Zone, there’s one prerequisite to all of this, and I don’t know how to teach this one. You have to be willing to let yourself go, and to get lost in the story you’re writing.

Have you ever seen a great musician playing their instrument? They often have eyes closed, singing the music to themselves, swaying back and forth. That’s the Zone. They are releasing themselves into the music and are not afraid of what others might think. They’re lost in it. Heck, they’re probably not even aware of how the audience is reacting in that moment. That’s what I want you to try and find. And if it’s new to you, it probably won’t come easily for a few tries. But here’s a few tricks to help you make your conscious mind shut up and let you get your best writing done.

Meditate

Yeah, I know, not what you were expecting. I’m not saying you should go climb a mountain and find some venerable old monk to teach you his secrets. You just need to clear your mind for a few minutes before writing.

Take 3-5 minutes where you won’t have any distractions. Sit comfortably and breathe deep, allowing yourself to relax. Until you get comfortable doing this, just focus on your breathing. Feel it coming in your nose, and back out your mouth. At first, this is going to be a pain. Your conscious mind won’t want to shut up. Why should it? It’s used to being in control, but if you can get it to shut up, you’ll find that your non-conscious mind will be able to do it’s job better, creating things for you based on everything that you’ve ever experienced in your life. Your non-conscious will help you write truer emotions, and more vivid scenes than ever before. Whenever you do have thoughts enter your mind, tell yourself it’s okay, and picture the thoughts floating away. Then get back to focusing on your breathing and relaxing.

After you’ve done this for a few weeks you might try holding a picture of your main character–or whichever character you will be writing this time–in your mind. Picture them in a natural pose for them, whether that’s a cocky, hip-jutting, hand on the hip pose, or a relaxed, about to fall asleep slink. Try to picture as much detail as you can. You’ll find that character become more real to you as you write because they’re there. Your conscious mind is not having to try to create (which is good – that’s not what it’s best at!) so it will stay quieter, and your non-conscious mind will bring you awesome new scenes and ideas based on that character and the emotions that you relate to characters like that.

Write Fast

The second thing you can do is to write fast. All the time. Here’s why.

Remember how slow the conscious mind is? It’s only 0.000005 times as fast as your non-conscious mind. As you’re writing, it becomes a big race between your story and your conscious mind.

If you write slow, your conscious brain has time to start picking away at your grammar, or coming up with better ways to write that sentence, or telling you that you suck, and you should be doing something else, and that you’re wasting your time. You know why it tells you that kind of stuff? Because it’s fighting years of us being told no, that we aren’t good enough, and can’t do things this way or that way. But that negative mentality doesn’t help us when we write. It holds us back and gets in the way of the story.

If you write fast, you can out-distance your conscious mind. It doesn’t have time to nit-pick. Instead, it tries to keep up with us, so it looks one step ahead of where we are, wringing it’s hands in its little OCD way. The conscious mind likes to be organized, so it tries to plan. But here’s what really happens when you’re writing too fast for it to keep with: it figures out where you’re going next, then sends the order to the non-conscious brain, so that the conscious mind can keep up with you. When it does that, your non-conscious mind sifts through thousands of ideas and checks how they relate to where your conscious mind tells you it’s going, and comes up with the best ideas that it can. And they’re quite often better ideas than we had when we plotted the darn thing out. It then sends its best idea back to the conscious mind who then sends it to your fingers before it has a chance to analyze it and tell us why it doesn’t work.

Here’s the catch. When we slow down and look at what we’ve done, your conscious mind throws a hissy fit. It stamps its feet and says, “That doesn’t work!” It says that because it knows what the plan is, and this new idea you just wrote doesn’t fit in with the current plan. What it doesn’t know is the new plan that the non-conscious mind gave you is based on so much more information and experience than the conscious mind has access to. It can’t see the new shiny new road made from seamless asphalt. Instead, it only sees the Romanesque brick road that it worked so hard to build in the first place. And the new road is almost always better.

Conclusion

If you want your work to move past a clever story into the realm of a fantastic read, the first thing you need to learn to do is to get out of your own way. Use meditation and speed-writing to shut your conscious mind up and keep it too busy so that it allows your non-conscious mind to give you a better story.

I’d love to hear your thoughts, reactions, and experiences. Let me know what you think so that we can continue this discussion and create even better ways to get our stories on paper.

Tell Me Ma

One of the presents that I got for Christmas (thanks Ma- and Pa-I-Laws!) is a brand new condenser microphone. I hadn’t had a chance to really try it out yet, so today, when the internet decided it didn’t want to cooperate and I couldn’t work on the website I needed to, I thought I’d take it for a spin.

So, I did a quick recording of Tell Me Ma, a traditional Irish (and possibly British before that?) children’s song, that has nonetheless become a popular tune in Ireland. I first heard it performed by the wonderful band, Gaelic Storm.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Would love to hear your thoughts on this quick version. I intend to go back in and record some whistle to go along with it, but not sure when I’ll get a chance to do that.

Oh, and for those curious types–yes, that’s all me. Singing, guitar and cajon (box drum). Had fun putting this together, even if the vocals aren’t spot on.

Lion Hunt

This is a little composition I put together a few months ago playing with loops in Logic. I had a blast learning and playing around with the software.

While you’re listening to the tune, close your eyes and picture yourself in the fields of Africa. Tall, burnt grass surrounds you. Suddenly, you spot a lion on the prowl. Or did he spot you? Let the music carry you and let me know whether the song ended happily or…not so happily for you. :)

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Reset

Due to technical difficulties (and a host that has rapidly slid down the ramp and launched into crappy-ness), the site you might be accustomed to seeing is now living in the ethers of time.

But we can rebuild it. We can make it stronger. Faster.

Any pages that have “Coming Soon” are currently being unearthed from the sands of Egypt with the care and skill of the finest archeologist. They will return shortly, I have been told.