Calendar in Zend Framework

不问归期 提交于 2019-12-07 19:26:23
user114303

Here is a simple Calendar class that uses Zend_Date and Zend_Locale that you can use as a starting point:

www.arietis-software.com/index.php/2009/05/26/a-php-calendar-class-based-on-zend_date/

I've created and embedded a calendar in a similar why to which you are describing. My approach was to implement the calendar as a view helper.

The helper, was called My_View_Helper_Calendar and has to contain a public method called calendar which I have returning an instance of the helper, like so:

public function calendar()
{
    // Calls to private methods here
    return $this;
}

As indicated, I set up some private methods within the view helper to do the calendar building, and had another public method called toHtml which renders the calendar as HTML.

That way, calling the helper from the context of a view file is as easy as:

<?= $this->calendar()->toHtml(); ?>

Hope this helps you get on the right track.

I've ran into a similar problem so I created a calendar for the Zend Framework. It uses Zend_Date and Zend_Locale as well as a view script for rendering. More info can be found at http://www.spiffyjr.me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!