All pastes #971956 Raw Edit

Something

public text v1 · immutable
·published 2008-04-05 02:26 UTC
rendered paste body
<?

function queryLatestCoupons(){
	return $this->select()
				   ->from("
					   	Coupons C,
					   	Stores S,
					   	CategoryMaps M
				   	")
				   ->where("
				   		 C.Active='1' AND 
				   		 S.Active='1' AND 
				   		 M.Active='1'
				   	")
				   ->groupBy('S.Store')
				   ->orderBy('C.CouponID')
				   ->sortBy('DESC');
}

function queryMostPopularCoupons(){
	
}

function by($str){
	$func = 'query' . str_replace(" ", "",$str);
	call_user_func($func);
}

$data = Site::load('Coupons')->by('LatestCoupons')->limit(32)->paginate("params=[key=page,options=[color=red,font=italic]]")->fetchAll();


$data = Site::load('Coupons')->by("Most Popular Coupons");



foreach($data AS $key=>$value){
	echo "$value[Coupon]<br>";
}