Arkadaşlar merhaba elimde bir php oyun scripti var, script ana sayfaya tüm oyunları kategorik olarak listeliyor. Ama ben yalnızca seçtiğim kategori ve ona ait oyunların listelenmesini istiyorum. Veritabanındaki tüm oyunları ana sayfaya yazdıran ana fonksiyon
Yukarıdaki ana fonksiyondu, bu fonksiyonu kullanarak ana sayfaya oyunları yazdıran fonksiyon ise
Bu konuda yardımcı olabilecek birileri varsa sevinirim
PHP:
function makeGamesListc(){
if(!$this->isLoaded()){
$this->Load();
}
$output = "";
foreach($this->gamedata as $category){
$cId = "";
$games = "";
$gamedata = "";
if(count($category['games']) > 0){
$count = 0;
foreach($category['games'] as $game){
if(($count % 2) == 0 || count($category['games']) == 1){
eval("\$cId['games'] .= \"".$this->template['game']."\";");
eval("\$gamedata .= \"".$this->template['gdoublewrapper']."\";");
$games = "";
} else {
eval("\$games .= \"".$this->template['game']."\";");
}
$count++;
if(count($category['games']) != 1 && (count($category['games']) % 2) == 1 && ($count == count($category['games']))){
eval("\$gamedata .= \"".$this->template['gdoublewrapper']."\";");
}
}
eval("\$output .= \"".$this->template['category']."\";");
}
}
return $output;
}
Yukarıdaki ana fonksiyondu, bu fonksiyonu kullanarak ana sayfaya oyunları yazdıran fonksiyon ise
PHP:
<?php
if(!isset($_GET['act']) || $_GET['act'] != 'play'){
echo $sys->makeGamesList();
} else {
if(isset($_GET['id'])){
echo $sys->makeGameHtml($_GET['id'], $_GET['cid']);
} else {
echo '<div style="margin: 30px;">
<strong>Error: </strong>Invalid Input<br /><br />
<a href="'.$_SERVER['PHP_SELF'].'">Click here to return Home</a>
</div>';
}
}
?>
Bu konuda yardımcı olabilecek birileri varsa sevinirim