Calendar in Zend Framework

2019-06-04 02:21发布

I looking to create a custom calender with Zend Framework, I am hoping that it will be able to list all the days of the month for the coming years and then have a different bg color on the date if there is an event on this. I am however struggling to create this firstly because it needs to go into the layout view, rather than an action, so where does the logic go? I am also unclear as to how the logic with mkdate() would work.

Can someone point me in the right direct please?

Thanks

3条回答
beautiful°
2楼-- · 2019-06-04 02:50

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

查看更多
时光不老,我们不散
3楼-- · 2019-06-04 03:04

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/

查看更多
SAY GOODBYE
4楼-- · 2019-06-04 03:10

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.

查看更多
登录 后发表回答