Zend Framework initialization shell scripts

Tags:

I’ve had a couple of cases where I’ve wanted to quickly test some stuff with the Zend Framework. Now, to get the framework up and running, you’ll need a couple of things:

  • Directory structure – controller dirs, view dirs, public_html, etc. etc.
  • .htaccess files – To enable routing
  • Bootstrap
  • Controllers

I can never remember what to put in the .htaccess files and I often forget the parameters for the front controller in the bootstrap. But what if you could do all these steps with a single command?

I want to be able to run a single command and get the framework up and running without doing anything else.
So, I decided to whip up my trusty Vim and write a couple of shell scripts to do it!

Read More

How to improve your JavaScript

Tags:

There’s a lot of resources on the internet related to coding JavaScript, but many of them are poor and out of date, which I believe is one of the reasons why a lot of people still can’t manage to write JavaScript code which works in all major browsers (IE, Firefox, Opera and Safari – where possible to test it)

Let’s check out some useful JavaScript resources to improve our skills, ranging from books to blogs and frameworks/libraries.

Read More

How to automatically escape template variables in Zend_View

Tags:

Escaping any data which comes from the server is important to escape, as it prevents XSS amongst other things.

The Zend Framework view component Zend_View let’s you escape template variables with $this->escape($this->variableName), but it doesn’t escape them by default. Wouldn’t it be much nicer if it did that by default, or at least provided you with a variable to turn it on/off?

Let’s find out how to do that!

Read More

Summing up Smarty and Zend View

Tags:

I’ve posted a couple of posts related to integrating Smarty with the Zend Framework:

  • Making a Smarty view class based on Zend_View
  • Integrating Zend View Helpers into Smarty

I’ve also posted some Zend_View related posts:

  • Using layouts with the Zend ViewRenderer helper
  • Creating a factory-object for building views

Let’s wrap up these in a summary of using them and what else could be done regarding these and the view solution in general.

Read More

Switching to WordPress

Tags:

I’m moving my blogging from My Opera to here at CodeUtopia.net for now at least.

I’ve installed WordPress here, and I must say it was quite painless to get it up and running. I had to do some digging through the documentation to find some features that I want to use, such as showing a small “teaser” of the posts on the front page for some posts.

I was working on my own simple blogging solution and a CMS until an unfortunate hard disk crash took out my server box and along went most of my programming projects. And don’t tell me to take backups! I’m a poor student, I don’t have money for things like extra hard disks for backing up stuff ;)

Also, I have other things to work on than the blog/cms project, so I kind of realized that it would take me forever to move my blog here, unless I used a ready-made solution like WordPress.

I’ve imported some of my old posts to this one, but it looks like that many of them look a bit bad, especially for the parts which include source code of some sorts. I’ve fixed a couple of them to behave a bit better, though.

Read More

Different PHP template engines

Tags:

Originally posted in my old blog at My Opera

While working on the Smarty View Helper solution I mentioned in the previous post, I went through a lot of Smarty's code and I also did some searching on their forums.

Smarty's code isn't very modification friendly and they had discussed associative array support for Smarty in their forums in 2003 – That's 4 years ago, and they still haven't got it in Smarty!

So, this got me thinking what alternative template engines are available. If Smarty hasn't got any real new features in a long time, others should have them. Right?

Here's a list of template engines I'll review and compare to Smarty, some more in depth than others: Blitz, patTemplate, vlibTemplate, SmartTemplate, Expose, Savant and PHPTAL.

Read More

The best Smarty + Zend View Helpers solution!

Tags:

Originally posted in my old blog at My Opera

Coming on again with the Smarty and Zend View related articles, let's this time take a look at how to get Zend's View Helpers running with Smarty.

Other examples for this that I have seen use a syntax like this: {helper helper=Url p='array(something)' p2=stuff}, which is kind of ugly and the array parsing is done with eval, and we know that Eval is Evil.

Wouldn't a more elegant solution let you use helpers just like you use Smarty plugins? In the style of just typing the name of the helper and simple parameters? Let's see how to make that happen!

Read More

Common Zend_Filter_Input problems

Tags:

Originally posted in my old blog at My Opera

Zend_Filter_Input, while a very useful component of the Zend Framwork, has some oddities that can cause a lot of headache if you can't figure it out right away.

  • Missing fields show up as valid even if they have validators that won't let empty values through
  • NULL values for existing fields

to name some.


Read More

Mozilla Prism: A fancy name for a technology as old as the browser

Tags:

Originally posted in my old blog at My Opera

Mozilla recently introduced Prism, which takes Widgetize to a whole new level.

Opera's Widgetize will turn your blog or RSS feed into a widget with some custom skins and stuff.
What Prism does is, it takes any website and turns that into a self-contained little browser.

While having GMail or such as a “stand-alone” application might sound nice, doesn't this remind you of something? Browsing without tabs.

You don't need a stand-alone application for this either. You could just use Opera to achieve a very very similar experience.


Read More