chris.lu

the css view helper (application / layout / helpers / css.php)

Posted 2011-02-15 23:06:59 by chris
The goal of this helper is also to make managing css files easier.

This css view helper is really simple, im not kidding ;) It looks really complex but it isn't. There are just so many lines of code because i load several css files.

If you create a website you will probably have several css files, one for the default layout, a special one for the sick IE (Internet Explorer), perhaps a reset css as i do, another one for handhelds, you will also probably use a javascript library which has it's own css file and so on... So in the end you will have to load several css files, most of them will not be minifed.

There are three ways to optimize your css files. If you use Google Pagespeed or Yahoo's YSlow, those Firefox addons will give you hints about how you could optimize your css file(s)...

The layout (application/layout/scripts/layout.phtml)

Posted 2011-02-13 22:42:00 by chris
This article will show you an example for a zend framework layout in html5. In the next articles i will show you the view helpers i use in this layout.

I know html5 is new and not supported by all browsers. Especially IE has problems with html5. But there is a solution for the html5 tags, the problem is, it's javascript, so if the user has deactivated javascript this hack won't work. To enable html5 tags in IE before IE9 we use the shiv javascript file from remy sharp.

http://code.google.com/p/html5shiv/

The index.php file (public / index.php)

Posted 2011-02-11 22:52:42 by chris
Zend Framework's controller uses the frontcontroller design pattern. All requests to the frontcontroller will get rooted through a single entry point, the index.php file.

The index.php will create an instance of zend application and run the application bootstrap process by using the bootstrap.php that we will create in our application folder.

First we define an APPLICATION_PATH, we will use it on several files in our application. Then we define the UPLOAD_PATH which will be used in our application everywhere we need the path of the uploads folder.

Now we define an APPLICATION_ENVIRONMENT. We try to use the value we have set in our htaccess file. If for any reason it's still not set we define production as our default environment type...

html5 blogroll

Posted 2011-02-06 20:43:36 by chris
HTML5 is coming soon to a browser near you ...

We will probably have to wait some more years until we can use all of it's features, because we will have to wait for the day when most users have one of the browsers that supports these features. But there are some features you can already use know and for the others html5 provides ways to include backwards compatibility.

Some features can also be used because there are javascript libraries that will emulate features that are native ones in modern browsers, like dojo toolkit form dijits, dojo io iframe file upload, flash multiple file upload and so on. You can also use javascript libraries like modernizr to check which features are used by the users browsers or you use of the web tools thats shows you which feature is used by all the browsers or you retrieve informations about when a feature can be used.

The future of zend framework, zend framework 2 is coming

Posted 2011-02-03 22:27:07 by chris
The first time i read about the new zf2 was on Matthew Weier O'Phinney's blog, here: http://weierophinney.net/matthew/archives/241-State-of-Zend-Framework-2.0.html

The Zend Framework 2 development started a while ago, if you want to participate in surveys or want to participate in the discussion you should subscribe to the zf-contributors@lists.zend.com mailinglist.

The main goals of Zend Framework 2.0 are to make a more consistent, a well-documented product, improving developer productivity and runtime performance...

A simple config file (application / configs / application.ini)

Posted 2011-02-01 21:45:23 by chris
We will need this configuration file to setup some default values for our application. We will see in the next tutorial how the index.php uses this file and passes its values to the application class to create an instance.

As you can see we have three parts in our configuration file, a config setp for the production environment. Another for the testing environment which inherits the values set for the production mode but changes some values. Finally a setup for the development environment which inherits the values from testing mode (and therefore also from production mode) but also changes some values.

The robots txt file (public / robots.txt)

Posted 2011-01-30 00:53:23 by chris
Here is an example of a robots.txt. All folders and files that are not disallowed will get indexed by the bots (search engine crawlers). Define a bot user agent and tell him which files or folders he shouldn't index (which he is disallowed to index).

For example you could disllow Bing (MSNBot) to index any of your pages by using diallow: /. You could also use the *, if you want to tell all bots that you disllow them indexing the folder /admin/. You can also specify the link of your sitemap in the robots.txt.

When your done setting up your robots.txt save it and put it in the public folder of your zend framework application...

The htaccess file (public / .htaccess)

Posted 2011-01-27 22:12:09 by chris
Now we can create our .htacess file. Go to the public folder an create an empty .htaccess file.

We will have 3 kinds of environments, the first one is "development", the second one is "testing" and the third one is "production". "development" will be the environment type we will use while developing our application. "testing" is for the testing of our application and finally "production" when we upload the application to the production server.

You can add more environment types if you want and you can change their name...

Application Directory (Folders) Structure

Posted 2011-01-26 00:00:00 by chris
My goal was to create a structure that is very easy to understand, flexible enough for big or small websites and not totally different from what books or other guides recommend as a best practice files and folders structure for a Zend Framework project.

Another goal was to create a core cms, which has lots of modules that can be used on multiple websites. Every module is designed so that it can be copied and put in another cms without having to modify any file of that cms. The module of a directory holds all the files it need to work, i has its own bootstrap, its configuration files, its views and of course its own models.

This post contains the recommended structure for an application developed using the Zend Framework (ZF) based on the quick start, but there are several changes made by me. I won't use the controllers folder, i will put my default controllers in the homepage module directory which is my default module. As you can see the MVC strucure is in the modules directory...
Content 1 - 10 from 13
First | < Previous | 1 | 2 | Next > | Last