All posts by Administrator

Adding TinyMCE to EE Wiki

Having found several requests in the forums and no tutorials online or in documentation, I’ve documented the steps I took to add the TinyMCE editor to my ExpressionEngine wiki.

I am using the EEDocs wiki theme to provide documentation for my users. Here are very quick and dirty instructions to add TinyMCE to your EE Wiki which basically follows the default instructions provided by the TinyMCE Wiki.

  • Download TinyMCE, extract it.

  • Upload the TinyMCE to your webserver, note the path.

  • Find the default PHP file for the EE wiki theme you are using. Mine was in my siteroot/themes/wiki_themes/eedocs/ folder and is called eedocs.php. The default them would be in the themes folder under wiki_themes/default/default.php. Open this in the editor of your choice. You may want to create a backup copy in case you need to revert later.

  • Add the following code to the <head> area:

    <script type="text/javascript" src="http://yoursite.com/yourpathto/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>

    Note you may want to test that path in your browser and make sure it is linking to the tiny_mce.js path as intended.

  • Add the following inline script to the <head> area :

    <script type="text/javascript">
    tinyMCE.init({
    mode : "textareas"
    });
    </script>

This will turn all of your textareas into TinyMCE editor fields. There are many other ways to configure this, you could specify exactly which textareas to use TinyMCE, for example. For all your TinyMCE customization options, see the TinyMCE wiki and for help knowing where to put what, check out the ExpressionEngine User Guide section on the Wiki Theme Template.

I can’t say I’ve done extensive testing yet, but the default TinyMCE install has not (so far) interfered with wiki markup at all, which is to say that [[Category:Foo::Bar]] and regular [[wiki links]] seem to be working happily.

Screenshot:
ExpressionEngine Wiki with TinyMCE

Update: Installed the MarkItUp editor in a similar fashion, I like it a lot more than TinyMCE out of the box. May be looking at Textile Editor Helper (TEH) and CKEditor as well, so check back for a WYSIWYG / markup editor showdown. In the meantime, consider what you need a WYSIWYG for and what markup under the hood you’re willing to live with in the long-term before settling on a solution for your site – here’s a good article that sums up that issue: WYSI-dangerous: Why WYSIWYG editors are bad for your website on redcloth.org.

Email protection using CSS

Email Link Protection - a graceful and user-friendly technique This post originally appeared on my personal blog in March of 2005. It is till useful a half decade later, so finally posting it here. This code is also available on Snipplr as well.

Any spambot worth its salt spawned by evil genius could "guess" email addresses by skimming for all 'alias@'s and automatically concatenate them with the site's url base and any other domains found on the page, so in the javascript I separate the '@' from the alias.

Enough about the wheres and whys, here's some cut n' paste fun for your use. This code will use javascript to display a normal, clickable mailto: link on your page and if javascript is turned off you still get a screen-readable, selectable email address displayed using a CSS trick.

<style type="text/css">
.backwards {
unicode-bidi:bidi-override; direction: rtl;font-weight:bold;
}
</style>
<script type="text/javascript">
<!--
linkAddy=('alias' + '@' + 'yourdomain.com')
document.write('<a href="mailto:' + linkAddy + '">' + linkAddy + '</a>')
//-->
</script>

<noscript>
<p>Please email me at
<strong><span class="backwards">moc.niamodruoy@saila</span>
</strong>.<br /></p>
</noscript>

Here's a version for you really paranoid folks that don't want live links at all (or maybe you just want a tiny user obstacle to ensure necessity of correspondence), but you do want your email address to appear correctly if possible but with better protection, plus insurance if javascript is turned off:

<style type="text/css">
.backwards {
unicode-bidi:bidi-override; direction: rtl;font-weight:bold;
}
</style>
Please email me at
<span class="backwards"><script type="text/javascript">
<!--
backAddy=('moc.niamodruoy' + '@' + 'saila')
document.write(backAddy)
//-->
</script></span>
<noscript><strong>alias at
yourdomain dot com</strong></noscript>

Here's a working example:

Please email me at

Here's a few other ways to protect email addresses from spam bots. If you have a preferred method not listed here, please let me know in the comments.

  • Graceful Email Obfuscation article from A List Apart takes it up a notch, with an htaccess rewrite and redirect. Could be worth setting up for a large site where you need to add email links quickly and easy.
  • Hivelogic Enkoder Form - use their form to generate some javascript. Works great but relies on javascript to work.
  • Addressmunger.com - uses ASCII, JavaScript, and scrambling of letters in your email address.
  • K'nechtology Email Encryption - encodes email addresses in to hexadecimal values. This isn't very secure as it would be extremely easy for a bot to decode hex.

Installing Netbeans PHP IDE on Ubuntu

Lizard Steals Green Bean

Nothing amazing going on, just a few tips that might save you some time:

  • You need java runtime installed and working, prolly apt-cache search to make
    sure you’re putting in the most recent version (6 as of this writing)

    • sudo apt-get update
    • sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-font
  • The netbeans in the repo is for the Java IDE, so don’t bother with apt-get
  • Download the install file here: http://www.netbeans.org/downloads/index.html
    • Be sure to pick the PHP bundle
  • If clicking on the netbeans-x.x-ml-php-linux.sh file gives you an error or tries to open in gedit or something, right-click > properties > permissions and check ‘allow executing file as a program’
  • Select Run (not ‘Run in Terminal’), running in terminal will throw some GTK errors

Next you might want to head over to the Netbeans website and watch the intro vid and orient yourself to the plethora of PHP-centric features.

As fair newb to programming in PHP I can’t say I’m qualified to suggest an IDE. So why Netbeans? It’s free. It porvides syntactic and semantic code highlighting for PHP and debugging through Xdebug. Folks in my Seattle PHP meetup group who know a lot more about programming than I do seem to really like it, every time I go to install Eclipse I am daunted by the website, instructions and innumerable options. Finally, it was recommended in the recent Smashing Magazine article The Big PHP IDE Test: Why Use One And Which To Choose (2009.02.11) so I stopped resisting.

Do you like it, recommend others over it?

Installing Plone 3.0 on Ubuntu 6.06

Plone on Ubuntu
Plone 3.0.2 on an 32-bit Ubuntu 6.06 LTS ‘Dapper Drake’ LAMP

What is Plone?Plone is a pretty cool content management system (CMS). Well, I think it’s cool based on some videos and documentation on their site. After comparing a lot of CMS options (including some really expensive closed-source stuff and 2 weeks of developer training on Sharepoint) I’m trying out Plone because a) open source is cool. b) Google people are smart, c) it supports LDAP authentication which I need for my all-M$ work enviro, d) there’s training/conferences/books/commercial support!? available and d) I’ve read some great reviews and CMS comparisons that rated it #1.

That was the good, now the most common complaint: hellish learning curve. Well, if you’re a developer and you’re going to customize beyond the existing system and available plugins. Why? Well, you’ll have to learn some python and the database is the rather obscure Zope instead of MySQL or SQL. In fact, I just read this on 456 Berea St (one of my fav dev blogs) and it gave me the shivers:

And the inital learning curve, even though I was a fairly good python programmer, was insane.

Then again, people told me Perl was insane too and I loved working with Perl. Besides, we’re just playing right now, right?

What is Ubuntu? - Ubuntu is a community developed, linux-based operating system that I use for a web server. ‘Dapper Drake’ is the release name for 6.06 LTS. (Keyword: LTS – long term support). It’s surprisingly easy to install. If you’re bored, geeky and/or have extra VMs or boxes lying around you should try a LAMP install and get your web server up in 15 minutes!

There’s already a Plone From Scratch HOWTO on the Ubuntu Forums, however it is for a previous version of Plone (2.0.5) and uses the apt-get method which I’ve noticed a lot of people in the forums having trouble with. Disclaimer: I do not provide ‘undo/uninstall’ instructions, other than, whip up a a LAMP on VMware and test it first or backup your system. I would welcome uninstall directions if someone who knows what they are doing could provide them.

Doesn’t Plone provide installation instructions? Well, yes. But when I started to read them I got real nervous. What the heck is gcc? libssl? TLS? etc. Those poor geeks at Plone don’t realize how noob noob can be! I tried to find better instructions (for me) at the Ubuntu Forums and instead I found a lot of people having problems trying to install Plone via Synaptic or apt-get instead of using Plone’s instructions. So here ya go.

You should already have gcc, g++, make and tar installed by default, but if you want to be anal do this:

sudo apt-get update
sudo apt-get install gcc g++ make tar

Sidetrack > (Possibly totally unnecessary step!) If you’re a fair server noob like me you have no idea what libssl and readline libraries and development headers are and what the heck is TLS? Google suggests it has something to do with mail encryption. I read some confusing stuff on Ubuntu Forums about RPM and a program called Alien that converts RPMs to DEB packages seemed probably unrelated but like a handy utility to have and so:

sudo apt-get install alien

Download the Plone Installer Package. I saved it in my home folder – it doesn’t really matter where you put it so long as you can find it.

wget -c http://plone.googlecode.com/files/Plone-3.0.2-UnifiedInstaller-Rev2.tar.gz
tar zxf Plone-3.0.2-UnifiedInstaller-Rev2.tar.gz
cd Plone-3.0.2-UnifiedInstaller

Here’s where you have to pay attention. You can do a ZEO or Stand-Alone install. “WTF?” you say? Yeah, well just pick your poison after reading all about it. Me, I’m doing a Stand-Alone as root install.

According to the README.TXT in the installation package my choice of standalone instance installed as root will result in Plone being installed to /opt/Plone-3.0.2 and libz and libjpeg libraries getting built in /user/local. A “plone” user will be added and Zope will be configured to run under that user id. You need to start Zope as root user (via sudo).

sudo ./install.sh standalone

Then a whole bunch of stuff happens. Lots of gcc (compiling) and checking for things (lots of yes and a few no-s in my case). Just wait, watch, hail Mary and knock on wood. This is a good time to read about the rest of this tutorial or creating new Zope/Plone instances if you want to do that. Or just catch up on your RSS feeds and I’ll hold your hand some more ;o)

If you’re real lucky, this is what you’ll see when it’s all said and done:


#####################################################################
###################### Installation Complete ######################
Use the account information below to log into the Zope Management Interface
The account has full 'Manager' privileges.
Username: admin
Password: XXXXXXX
Before you start Plone, you should review the settings in:
/opt/Plone-3.0.2/zinstance/etc/zope.conf
Adjust the ports Plone uses before starting the site, if necessary
To start Plone, issue the following command in a Terminal window:
sudo /opt/Plone-3.0.2/zinstance/bin/zopectl start
To stop Plone, issue the following command in a Terminal window:
sudo /opt/Plone-3.0.2/zinstance/bin/zopectl stop
Plone successfully installed at /opt/Plone-3.0.2
See /opt/Plone-3.0.2/zinstance/adminPassword.txt
for password and startup instructions
Ask for help on plone-users list or #plone
Submit feedback and report errors at http://dev.plone.org/plone
This installer was created by Kamal Gill (kamalgill at mac.com)
Maintainers for Plone 3 are Kamal Gill and Steve McMahon (steve at dcn.org)

First, write down your admin password!! Then, check zope.conf to ‘review settings’. I’m not familiar with them, so I just scanned for the port. Found it on line 969 (YMMV), set to the default Zope/Plone standalone install grabs, port 8080.

sudo vi /opt/Plone-3.0.2/zinstance/etc/zope.conf

Use :q! to quit vi without messing anything up

Use netcat to see what ports you have open already. (Netcat comes with Ubuntu install)

nc -z -v -w2 localhost 1-65535

After confirming that 8080 is avail (or changing it in zope.conf if it is not available) continue following directions.

sudo /opt/Plone-3.0.2/zinstance/bin/zopectl start #that last part is an L not a 1, took me a while...

Then go to: http://localhost:8080 (or sub servername for localhost to test from other computer). If you’re lucky AGAIN you’ll see the Zope Quick Start page!! Wahoo! Hii Fiiiiveh to self! Then look at the example site: http://localhost:8080/Plone, and then check out the management interface at http://localhost:8080/manage. Have fun. I hope it was as good for you as it was for me!

BTW: I suggest the Ubuntu Support Forum and Plone Support Forum for help. I am totally new at server administration, I prolly shouldn’t even publish this and I definitely can’t support your lazy arse!

Carbon Neutral Website Development

Carbon Neutral Websites? Check your smug factor!
Carbon offsetting is very trendy right now. Just last week my boyfriend purchased a wind power offset. I was sort of surprised as we’d never discussed offsetting, and asked him what his motivation was. "It’s for the electricity that I use, this card makes government purchase wind power." The thing is, we live in Seattle, where electricity pretty darn green already and there’s a program for utilities customers to contribute to directly.

Via the 9Rules Network I ran across Darren Stuart’s suggestion on the Web2.0 Show that websites developers become carbon neutral and that not only is it a good thing for the Earth, but it’s a great for marketing. A lot of people chimed in right away with "Oh yeah…I’ll plant a tree! Great!!" kind of stuff. A quick search for “carbon neutral website” indicates the trend has already begun (at least it has in the UK).

There’s more to offsetting than planting trees

I was both excited to see that environmental responsibility is becoming so mainstream and at once dismayed at this continual emphasis on mindless offsetting. Like most political and scientific issues, the devil is in the details. Many early offset companies actually hurt more than helped, through poor planning and lack of follow through. The validity of tree-planting offsets remain questionable both as to the long-term effectiveness of successful programs and the lack of ability to guarantee said trees will remain healthy and protected long enough to do any good in the first place.

And then there’s basic concept of carbon offsetting. Many have criticized the practice as allowing people guilt-free passes for ongoing irresponsible behavior. I agree that it should be only part of a persons efforts to do their part. I mean if you’re driving an unnecessarily gas guzzling car, indulging in excessive and unnecessary trips or think recycling only has to do with your computer desktop then purchasing a bunch of offsets shouldn’t be your only focus! I’m already gritting my teeth at the inevitable trend of smug “carbon neutral website” banners on the sites of people who’ve never even bothered recycled their hazardous electronic equipment.

Now, lest I wreak of smug myself, I must announce: I am no saint. I don’t own a car, I walk to work, I bus or bike whenever it’s reasonable. I recycle avidly (including compost and proper disposal of hazardous materials) at work. But I must admit, I don’t recycle at home as well as I could because our landlord doesn’t offer options (or take opinions!) so it’s not convenient. I borrow my boyfriends gas hungry work truck usually only when I need it, but occasionally when I’m just feeling lazy. I indulge in long, hot showers. And more I’m sure. All I’m saying is, if you’re going to offset and especially if you’re going to toot your horn about, research your options and choose responsibly!

Should you purchase offsets? And if so, which ones?

The Wikipedia entry ‘Carbon offset’ is currently very informative and cites a plethora of references, both skeptic and optimistic. This should keep you busy for a while and help you determine whether it’s the right choice, or the first choice for you. The article Shifting Into Neutral by Emily Main on National Georgaphic’s Green Guide web site should help you understand the basic differences in available offsets. Then head on over to TreeHugger.com for the latest on carbon offset providers.