Fun with Symbolic Links, Addons, and ExpressionEngine


- Lance Johnson 11.21.2010

blog_image

Symbolic links are one of those things that you probably don’t come across unless you are trying to solve a problem that they are the solution to. We like to use symbolic links to keep a handle of a number of things in a local development environment - mainly, addons.

  So I guess let’s learn about symbolic links and how they can be utilized for maximum maximumication*.

What Are Symbolic Links?

  We don’t really need to get too technical, but basically symbolic linking is a way to put a file or folder in multiple places. What makes symbolic links awesome is the fact that the folder or file link will act just like it is the real thing.

  For instance, here is a path to an actual file inside an actual folder:

  /computer/system/folder/file.php Now let’s say we have a symbolic link of folder, and we put that into /computer/another_system/. And then our PHP code uses this file path:

  /computer/another_system/folder/file.php Bazam! That will work. So will any other files within folder. The computer thinks they are there, but they are really someone else. Magic.

  Note: Symbolic links are not the same thing as file aliases. They share some features but will not work for this application.

Making a Symbolic Link

  If you are on OS X, I recommend a handy little symbolic link maker tool called Symbolic Linker which gives you a contextual menu option to make a symbolic link. You can also use the terminal, but I find this way much easier.

  Note: Lance would use the terminal because he likes it. He also drives a stick shift in San Francisco.

  To create a link, simply open the contextual menu, and find “Make Symbolic Link”.

  Make a symbolic link You’ll get a folder called the original name of the folder plus “symlink”. You can rename this file to whatever you’d like.

  Symbolic Link Folder That’s it! You now have a symbolic link.

Example: Master Addon Folder

  We all have our addons that we use over and over again, and when beginning a new ExpressionEngine site, time is wasted installing new addons as you need them.

  What we like to use is a master addon folder separated out into the addon themes and the actual addon files.

  Addons Setup For every new local ExpressionEngine install, instead of copy/pasting all of the addons we use over and over, we simply make a symbolic link to those folders and put them in the correct places in the system.

  When we open up ExpressionEngine for the first time for a project, we simply go in and active the addons we need to start with, and then the ones we require as we go on. The addon installation is recorded in that ExpressionEngine install’s database, as well as any addon data. The files just do their thing.

  When a new version of an update comes out, just replace it in your master addon folders, and it will update for all of your local installs. When you want to deploy, just grab the addon folder your need and upload ‘em.

Grow Your Own

  Everyone’s setup is different, so your use of symbolic links will differ depending on your workflow. However, there is no denying that they are an awesome little tool for certain situations.

  Just try to deny it. You can’t.

  Point - made.

  *Not a word.

schedule a call
Comments