Adventures in Lifelong Development /pavlakis

  • Skip to content
  • Jump to main navigation and login

Nav view search

Navigation

  • Home
  • About Me
  • PHP
  • Javascript
  • Random Thoughts

Search

PhpIMinifier - Compress your Javascript and CSS files with PHP and YUI

  • Print
  • Email
Details
Created on Wednesday, 28 December 2011 21:01

This is a script that I've been meaning to write for a very long time. Ever since I read the book by Steve Souders - 'High Performance Web Sites' this has been on my mind, but didn't need anything like this since the websites I built in the past weren't quite this big.

Initially, I've created this to be used for a very specific Zend Framework application. However, I have made it generic enough and removed the ZF parts to avoid confusion.

So, what does this script do?
The PhpIMinifier is a PHP Directory Iterator that will compress all your css and js files using the YUI Compressor.

Read more: PhpIMinifier - Compress your Javascript and CSS files with PHP and YUI

ZF2 -some- New Features (in a Nutshell)

  • Print
  • Email
Details
Created on Friday, 07 October 2011 19:01

This short post is based on a few things I learned at a tutorial day on PHPNW11 with Rob Allen (@akrabat) going over ZF2 at its current state.

Covered some of the basics initially, like autoloader and the new way it is done on ZF2 using class map. It works by loading a script (obviously before deployment) to map all classes on an array, so that the autoloader will work much faster by including a file if found in the array.

We also looked into namespaces and how they work - which I slowly am starting to like - and shown some examples on an ZF2 application.

A more advanced concept and implementation was that of Dependency Injection. (I will write more about it once I have a play with a ZF2 project using it some more)

My favourite from today has to be the EventManager. Using the 'Observer' pattern, having the ability to trigger events when required. I can see how that can be used even now, by just adding that functionality side by side to a ZF1 project. Even more to experiment… :)

One last thing that I would like to mention, is the controller is used. We no longer need to pass a variable to $this->view. Instead, that happens automatically by returning an array. If the value is a string, then it gets escaped automatically.
When in the view, we can just echo the variable name directly.

Now time to have a play with ZF2… More to follow when I get my head around this! :P

**Note: One thing I'm interested in finding out how it works, is ContextSwitch. And again. Need to get my hands dirty to see how that works!

Choose your default action in Zend Framework

  • Print
  • Email
Details
Created on Tuesday, 29 March 2011 12:41

I have an action that I want to pass parameters to. But, I also want to be able to use the other actions in that controller.
Only if those actions are not found, I want to default to a specific action.

The example I am going to use here is Subscribe. I want my users to be able to see a different subscription page depending on the type of subscription. So I have three main use cases:

  • Subscribe using a promotional code
  • Subscribe for the basic version
  • Subscribe for the full version

To do any of the above, I want to use the index Action. However, in the same controller I also have actions for:

  • confirm
  • activate
  • unsubscribe

In order to be able to identify the type of subscription, I will need to pass a parameter for that. Also, if the user has a promotional code, I want that as a parameter also.

Read more: Choose your default action in Zend Framework

Moving a Website to a new Provider

  • Print
  • Email
Details
Created on Sunday, 27 March 2011 23:35

Moving a website can be a tricky task and it usually helps being extra careful than having an unsatisfied customer. Below, I will just outline a few simple steps I take to make sure that everything goes smoothly. First of all, when you decide to move server or hosting provider, give yourself a bit of extra time and get the new package first. This way, you will have enough time to do the switch with less stress; especially if you don’t know the environment or control panel being used.

Read more: Moving a Website to a new Provider

Page 1 of 2

  • Start
  • Prev
  • 1
  • 2
  • Next
  • End

Powered by Joomla!®