我正在尝试开发一个日历模块,其中包含以下打印日历的类
class modJeventsCalHelper
{
public function showcal() {
$year == null;
$month == null;
if(null==$year&&isset($_GET['year'])){
$year = $_GET['year'];
}else if(null==$year){
$year = date("Y",time());
}
if(null==$month&&isset($_GET['month'])){
$month = $_GET['month'];
}else if(null==$month){
$month = date("m",time());
}
$this->currentYear=$year;
$this->currentMonth=$month;
$this->daysInMonth=$this->_daysInMonth($month,$year);
$content='<div id="calendar">'.
'<div class="box">'.
$this->_createNavi().
'</div>'.
'<div class="box-content">'.
'<ul class="label">'.$this->_createLabels().'</ul>';
$content.='<div class="clear"></div>';
$content.='<ul class="dates">';
$weeksInMonth = $this->_weeksInMonth($month,$year);
// Create weeks in a month
for( $i=0; $i<$weeksInMonth; $i++ ){
//Create days in a week
for($j=1;$j<=7;$j++){
$content.=$this->_showDay($i*7+$j);
}
}
$content.='</ul>';
$content.='<div class="clear"></div>';
$content.='</div>';
$content.='</div>';
return $content;
}
}
然后我将内容存储在$ calendar
中$calendar = modeventscrollerHelper::showcal();
但是我收到错误
不在对象上下文中时使用$ this
我已经安排了一个测试类来打印你好
public static function getscroller($params)
{
return 'Hello, World!';
}
使用
时效果很好$ scroller = modeventscrollerHelper :: getscroller($ params);
你能帮我解决这个问题吗?
谢谢, 西。