Entries Tagged with: expressionengine
Drama...sigh
Be a part of the solution
Ah, it's winter. (side note: I seriously need to get the winter theme up and going on my site.) It's that time of year where the ExpressionEngine user-base starts to get restless. Oh, who am I kidding, it can happen at any time of year. So a recent comment on Kenny's article over at The Nerdary got me thinking, and I decided to dust off my long ignored blog.
I don't think users of ExpressionEngine have any clue what it's like to be a developer at EllisLab, what it entails, or what the fuck they ...
Read More
Know what ORMs and Query Builders do!
ORMs and Query Builders such as the Django ORM and CodeIgniter Active Record classes are great time savers. But you can get yourself into performance trouble if you're not paying attention to what these are doing behind the scenes. I think the biggest mistake people make is they use tools like this as crutches for not understanding how to write simple SQL statements. Don't fall into this group! If you're in it, work hard to get out!
I'll show a couple of examples from both to illustrate how you can give your applications a performance boost ...
Read More
var_dump($this) in EE/CI with no recursion
Here's a quick little tip for all you EE addon developers out there. I've seen some people moaning on Twitter about how a var_dump() can be hard on the browser due to the recursion in the CodeIgniter singleton. So check how I like to roll in my CI libraries/EE addons.
<?php
class Foo {
protected $_foo;
public function __construct()
{
$this->_foo = $this->config->item('something');
}
}
Look maw, no $this->CI
Did you know you you can do this in a CodeIgniter library or an ExpressionEngine mcp/mod/extension/plugin/accessory file? It's pretty easy to accomplish, and ...
Read More
Showing PHP Memory Usage through your Template
Ever been deep in troubleshooting performance issues in your ExpressionEngine site and wondered what kind of memory is a certain plugin/weblog tag, etc is taking up? Unless you're holding out from blogging about it, there's absolutely no way I'm aware of that you're getting that info from shell on the server. So, here's a quick and dirty hack to EE's template parser that will show you this info.
Pop open system/expressionengine/libraries/Template.php and look for:
<?php
function log_item($str)
Now, a quick addition in there and you're good to ...
Read More
Session Cache in ExpressionEngine
I think the session cache may quite possibly be one of the more under used tools in the third-party ExpressionEngine developers toolbox. The speed/performance increases from strategically caching items in this can be substantial. As with anything you do while developing your addon, benchmarking needs to be done every step of the way to ensure you aren't overdoing it and actually causing issues. I want to illustrate how adding something to the session cache can give a nice performance boost.
What is the session cache?
First, see the docs.
If you're a developer and haven't had ...
Read More
DB Results in ExpressionEngine and CodeIgniter
I learned PHP by forcing myself to try to create ExpressionEngine addons. I studied the 1.x code. I poured over the CodeIgniter core, trying to figure out how the heck it worked. One thing that confused me was how the heck do I get a single result from an active record query! If you're in this boat, I hope this might help clear it up for you a bit.
In ExpressionEngine 2.x, unless you're doing something extremely complex, using the CodeIgniter Active Record class is the way to go.
For instance, if we want to do ...
Read More
How about a soft launch on a Friday?
Check Out Pkg.io!
At SXSW this year, Marcus Neto and I wanted to build something. Our fearless leader Leslie Camacho bet us we couldn't. Well, it was on like donkey kong. We enlisted the help of Pascal, started brainstorming, and came up with pkg.io.
At this time, it's an addon skeleton maker for ExpressionEngine developers. What we're most happy with, is someone with no knowledge of PHP will be able to make an accessory to use on their client sites. We think we have some fun things in store, but wanted to get something out now.
Since we code ...
Read More
Let's build an ExpressionEngine Module!
Control Panel Page (mcp file) and model. Part One
- Project Setup and Module Installation
- Control Panel Page (mcp file) and model. Part One
- Control Panel Page (mcp file) and model. Part Two
- Front End Template Tag
I decided to break the control panel portion into two parts, so this will now be a four part series. First, we're going to build the form to submit a short link. This will include a model, view and controller (mcp file).
So, let's start by setting up the base for the module control panel file (mcp.shortee.php). Open that up in your editor, and let's get to work ...
Read More
Let's build an ExpressionEngine Module!
Intro & Install/Update File
- Project Setup and Module Installation
- Control Panel Page (mcp file) and model. Part One
- Control Panel Page (mcp file) and model. Part Two
- Front End Template Tag
I think I'm a bit different than most in how I view the ease in which to build the different types of ExpressionEngine addons, but I definitely think that in most cases modules are not a heck of a lot more difficult than Plugins. Personally, I find Extensions the most difficult as you have to develop with a keen eye to ensure your extension is playing nice with the rest of the ...
Read More
Constructor-structor, what's your function?
I'd like to set the record straight on the usage of class constructors in CodeIgniter and ExpressionEngine apps/addons. I have seen EE-addons and CI code examples using them where they are not necessary. To illustrate this point and make things a bit more clear, I removed the class constructor from the CodeIgniter 'welcome' controller last night. Since your controllers in CI extend CI_Controller, you automatically inherit all the code that is contained in CI_Controller::__construct().
So for instance, if you have a controller like:
<?php
class Foobar extends CI_Controller {
public function index()
{
$this->load->view('foobar');
}
}
or a ...
Read More
Default Values in ExpressionEngine's TMPL->fetch_param()
It is documented, and some of you may know, some might not. In ExpressionEngine 2.x, TMPL->fetch_param() has changed a bit, so you can assign a default value to the tag parameter you're getting from the template.
So in 1.x where you would have:
<?php
global $TMPL;
$limit = ( ! $TMPL->fetch_param('limit')) ? 100 : $TMPL->fetch_param('limit');
In 2.x you can now do:
<?php
$limit = $this->EE->TMPL->fetch_param('limit', 100);
Yay for less code that's easier to read!
Read More
Get your SQL on
Harnessing the Power of ExpressionEngine's Query Module
The Query Module in ExpressionEngine is one of my most favorite, and I think one of the most underutilized gems of the product. As I have previously discussed, it's almost always better to use a Plugin or Module rather than turning on PHP in your templates. If the weblog/channel module is overkill, the query module is where it's at.
You need to know how to write MySQL queries, and need to study the ExpressionEngine schema a bit. After getting that under your belt, you'll have a new weapon in your arsenal to attack content layout issues ...
Read More
Want an ExpressionEngine License to help you get started?
Fusion Ads released an absolutely amazing bundle yesterday with a slew of awesome stuff. Included in the bundle is a ExpressionEngine Freelancer license. For obvious reasons, I do not need this license :-) So, with some co-workers, I'm going to give away my license along with the complete series of Learning ExpressionEngine 2 screencasts by Ryan Irelan. What a deal, eh?
So, here's how it's going to go down.
Qualify
- You're a small agency of three (3) people or less who does not yet use ExpressionEngine, but want to take the plunge.
- You're a web programming ...
Read More
Updating EE CodeIgniter version after the big PHP5 changes.
As I've mentioned before, we use a subrepo for CodeIgniter on our products at EllisLab. So, we occasionally update the sub repo as we want to pull changes in CodeIgniter into the project. So a few weeks ago starting with this revision, Pascal and I went hog wild ripping PHP4 dependencies from CodeIgniter. It was a joyous and liberating experience to say the least. So now the scary part. We need to merge these CI changes into ExpressionEngine and MojoMotor. Well, we took a deep breath, updated that subrepo to the latest version of CI and went to work ...
Read More
For the performance minded
Aaron over at Causing Effect released a little gem of a plugin to help find trouble spots in your templates. This should be standard in your arsenal while developing ExpressionEngine sites. Let's all be performance minded.
Nice work, Aaron.
Read More
Find ExpressionEngine versions with find
Do you manage a bunch of ExpressionEngine installs on the same server? Wanna see what versions they are all running? It's easy with find.
$ find . -name 'config.php' -print0 | xargs -0 grep 'app_version'
This will give you a path to the config file so you know what installation you're working with. :)
Yay for cli-foo!
Read More
Think before you turn it on
The catch 22 of caching in EE
ExpressionEngine's caching in both 1.x and 2.x are as misused as nesting exp:channel:entries tags inside each other.
First thing's first. What kind of environment are you in? Is this a high performance, load balanced setup with network-based storage and your database on its own server? Is this a cheap VPS, or perhaps a "dedicated" server that's nothing more than a 4-5 year old tower sitting on a bread rack? (ohh, but it's got RAID) :: cough ::
Okay, let's go over the assumption that we're smart enough to not go the cheap ...
Read More
Deploy ExpressionEngine with Fabric
A lot of people use Capistrano and GitHub for their ExpressionEngine deploys, I wanted to show an alternative, BitBucket and Fabric.
There isn't quite the level of automagic in Fabric as with Capistrano, but being a sys admin, automagic scares the shit out of me. Anyhoo, I posted yesterday about developing on the CodeIgniter trunk, and in my base repository I linked to, I have a file in the base named fabfile.py. If you keep a similar repository setup to what I have, this will work splendidly for you. If you don't, you'll need to tweak ...
Read More
With Great Power Comes Great Responsibility
How the decisions you make in your ExpressionEngine templates affect site performance.
A lot of us are drawn to ExpressionEngine because PHP isn't pre-requisite knowledge to make a kick-ass dynamic website. If we need to roll our own PHP we can if absolutely needed. PHP directly in the templates is fantastic for small chunks. I do want to illustrate the kind of issues that may arise if you are putting too much PHP into your templates, and show alternatives.
First, I need to do a custom query and want to use some CodeIgniter Helpers and Libraries too. If we were in straight CI, this would look pretty simple if broken between ...
Read More
Make No Assumptions With Asset Management
Something I've noticed lately is that people don't pay much attention to how they manage their static web resources. Be careful, as this can come back to bite you in the ass some day. Picture this, you're a day out from an extreme traffic event and you have notified your hosting company (please, notify your hosting company). What will you do if they say, "Let's get static resources moved over to a CDN."
uhh, what?
Let's imagine you are 24 hours out from being featured on Oprah. Your basic in-house 'dedicated' server ain't going ...
Read More