>> Zend_Layout example  (12,361 views)

Table of contents for Zend Framework

  1. Zend Framework and Smarty integration
  2. A better Zend Framework & Smarty integration
  3. Zend_Layout example

This example focuses on 3 aspects of the Zend Framework (v1.6):
the Zend_Layout mechanism, modules and helpers, including the ActionStack helper and a custom helper. (Please note that there is no Smarty involved in this example).

The main objective of this post is to demonstrate how components of ZF work together to produce a simple application, for this reason I will focus on the code that holds things together rather than going through line by line.

If you have any questions or things are not clear please leave a comment.

As in the previous posts in the series you can download the full working example here: zend_layout_example.zip (3.36 MB). (Note: the compressed file includes the ZF library hence about 3MB)
Please glance at the previous post on this series for hints on how to set up this example on your working server.

Lets start where all begins: bootstrap.php (more…)


I am developing a site and on one of the pages I added an updateable (from a custom CMS) scrolling text banner.
The client was really impressed and asked me to make one on the front page as well.

I thought of sharing this because although to make a scrolling text banner in javascript is quite easy is still producing a good effect (when not overused) specially when the text can be updated at will from a CMS.

Here is the code that does most of the work:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * @param elem Element (div) containing the text to scroll
 */
function scrollText(elem)
{
    if (elem) {
        var str = elem.innerHTML;
        // get the first character of the string
        var firstChar = str.substr(0,1);
        // get the whole text except the first character
        var sub = elem.innerHTML.substr(1);
        // attach the first character at the end of the string and replace the element content
        elem.innerHTML = sub.concat(firstChar);
    }
}

The above function is called at regular intervals using the following line of code:

setInterval('scrollText(document.getElementById("text-to-scroll"))', 333);

Unzip the following file: scrolling.html.zip (999 bytes) to see the complete example.

I always listen to Japanese radio on-line, specially if I am doing some routine coding.

I often listen to: http://www.japanaradio.com/ I think is really good and if you have never listen to it and you like J-Pop, than you should try it.

However while I was looking at some alternatives I came across this listing: http://www.multilingualbooks.com/online-radio-japanese.html#about.

Is a good list with a lot of choices and the links seems up to date.

And this is the one I like most so far: http://www.mumix.net/radio/m3u/mumixradio.m3u

Table of contents for Zend Framework

  1. Zend Framework and Smarty integration
  2. A better Zend Framework & Smarty integration
  3. Zend_Layout example

Since the first post on this series I have been working with the Zend Framework and Smarty extensively and I have greatly improved my previous integration between Smarty template engine and ZF.

I have prepared and example that you can download from the following link:
zend.zip (3.5 MB) the compressed file includes the ZF and Smarty packages.
The zip file should unpack as follow: (more…)