A very puzzling challenge - Please Help
Posted: Mon Dec 28, 2009 2:32 am
Hi there I am new to this forum just signed up. I have been trying to learn php for a short while no and trying to sort this piece of code out.
I have this code originally;
AND I want to change it to allow the use of this, which is some css and html code;
Please Help If you could thanks
I just looked over it and it looks very long lol but each one is a different file and they link together. I am sooooooo confused. One more not the 2 chunchs of code above actually works but its not very good
I have this code originally;
Code: Select all
<?
include_once('oticos_config.php');
function hiVis($name, $start, $items, $cols, $sql, $markup, $blankmarkup='') {
$sql .= " LIMIT $start, $items";
$i = $items;
$rowname=$name;
$result = mysql_query($sql);
$nrows = mysql_num_rows($result);
if ($nrows < $items) $items = $nrows;
?>
<table class='<?=$name?>' width='100%'>
<?
while ($$rowname=mysql_fetch_assoc($result)) {
$m = $$rowname;
// This is responsible for getting the tags from the database and getting them ready to be displayed
if (isset($m['GameID'])){
$q1 = "SELECT Name FROM `_tegsLog` LEFT JOIN _tegs USING ( idTeg ) WHERE _tegsLog.GameID = '$m[GameID]' ";
$res1 = mysql_query( $q1 );
if( 0 == mysql_num_rows( $res1 ) ) {
$tegAll = '';
}else{
$tegAll = array();
while ($tegs = mysql_fetch_assoc($res1))
{
$tegAll[].= $tegs['Name'];
}
$tegAll = implode(', ',$tegAll);
}
$m['tegs'] = $tegAll;
}
// This is responsible for getting the name of the person that uploaded a particular game and getting it ready to be displayed
if (isset($m['AccountID'])){
if ( $m['AccountID'] !=0 ){
$q2 = "SELECT concat(firstname,' ',lastname) as fullName FROM `_account` WHERE idUser = '$m[AccountID]' ";
$res2 = mysql_query( $q2 );
$from = mysql_fetch_assoc($res2);
}else{
$from['fullName'] = '';
}
$m['from'] = $from['fullName'];
}
$$rowname = $m;
//$the_markup = $markup;
eval ("\$the_markup =\"$markup\";");
if($i % $cols == 0){
?>
<tr class='cols<?=$name?>'>
<?
}
?>
<td class='item<?=$name?>'>
<?=$the_markup?>
</td>
<?
if($i % $cols == $cols-1){
?>
</tr>
<?
}
$i++;
}
if($i % $cols !== 0){
?>
<td colspan=<?=$cols-($i % $cols)?> class='blank<?=$name?>'>
<?=$blankmarkup?>
</td>
</tr>
<?
}
?>
</table>
<?
}
?>Code: Select all
<?
include_once('hiVis.php');
$ratingAnonim = <<<EOT
<div id='rating' style='width: 80px;margin-left: 45px;'>
<ul class='star-rating'>
<li class='current-rating' id='current-rating' style='margin: 0px ! important; background: transparent url(images/star/alt_star.gif) repeat scroll left center ! important; width: {\$oticos_rand['Rating']}px; -moz-background-clip: -moz-initial ! important; -moz-background-origin: -moz-initial ! important; -moz-background-inline-policy: -moz-initial ! important; left: 0px ! important;'></li>
</ul>
</div>
EOT;
$ratingUse = <<<EOT
<div id='rating_rand{\$oticos_rand['GameID']}' style='width: 80px;margin-left: 45px;'>
<ul class='star-rating'>
<li class='current-rating' id='current-rating' style='margin: 0px ! important; background: transparent url(images/star/alt_star.gif) repeat scroll left center ! important; width: {\$oticos_rand['Rating']}px; -moz-background-clip: -moz-initial ! important; -moz-background-origin: -moz-initial ! important; -moz-background-inline-policy: -moz-initial ! important; left: 0px ! important;'></li>
<span id='ratelinks_rand{\$oticos_rand['GameID']}' class='rate_no{\$oticos_rand['canRate']}'>
<li><a href='#' onclick='sendRating(1,\"{\$oticos_rand['GameID']}\",$account[idUser],\"rating_rand{\$oticos_rand['GameID']}\");return false;' title='1 star out of 5' class='one-star'>1</a></li>
<li><a href='#' onclick='sendRating(2,\"{\$oticos_rand['GameID']}\",$account[idUser],\"rating_rand{\$oticos_rand['GameID']}\");return false;' title='2 stars out of 5' class='two-stars'>2</a></li>
<li><a href='#' onclick='sendRating(3,\"{\$oticos_rand['GameID']}\",$account[idUser],\"rating_rand{\$oticos_rand['GameID']}\");return false;' title='3 stars out of 5' class='three-stars'>3</a></li>
<li><a href='#' onclick='sendRating(4,\"{\$oticos_rand['GameID']}\",$account[idUser],\"rating_rand{\$oticos_rand['GameID']}\");return false;' title='4 stars out of 5' class='four-stars'>4</a></li>
<li><a href='#' onclick='sendRating(5,\"{\$oticos_rand['GameID']}\",$account[idUser],\"rating_rand{\$oticos_rand['GameID']}\");return false;' title='5 stars out of 5' class='five-stars'>5</a></li>
</span>
</ul>
</div>
EOT;
if( $account['role'] =='anonymous' ){
$zapros = "SELECT * , IFNULL((Rating*15),0) As Rating, 'null' AS canFav FROM _games ORDER BY RAND()";
$rating = $ratingAnonim;
}else{
$zapros = "SELECT *,IFNULL((Rating*15),0) As Rating, (SELECT count(_rating.GameID) as canRate FROM _rating WHERE idUser=$account[idUser] AND GameID=_games.GameID) as canRate, (SELECT count(_favorites.GameID) as canFav FROM _favorites WHERE idUser=$account[idUser] AND GameID=_games.GameID) as canFav FROM _games ORDER BY RAND()";
$rating = $ratingUse;
}
$display = <<<EOT
<table border='0' cellpadding='0' cellspacing='0' height='78' width='100%'>
<tbody><tr>
<td align='center' height='78' valign='top' width='126'>
<table>
<tbody><tr>
<td align='center' background='images/game_im_bg126x76.jpg' height='78' valign='middle' width='126'><a href='game_play.php?game={\$oticos_rand['GameID']}' ><img src='http://games.oticos.com/img.php?f({\$oticos_rand['GameID']}.jpg)+w(120)+h(72)+q(100)' alt='{\$oticos_rand['Name']}' ></a></td>
</tr>
</tbody>
</table>
</td>
<td valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody><tr>
<td width='10'> </td>
<td class='style25' height='20' width='200'><a href='game_play.php?game={\$oticos_rand['GameID']}' >{\$oticos_rand['Name']}</a></td>
</tr>
<tr>
<td height='56' width='10' id='favorites_rand{\$oticos_rand['GameID']}'>
<a href='#' class='favorites fav_{\$oticos_rand['canFav']}' onclick='sendFav({\$oticos_rand['canFav']},\"{\$oticos_rand['GameID']}\",$account[idUser],\"favorites_rand{\$oticos_rand['GameID']}\");return false;'></a>
</td>
<td height='56' valign='top' class='style_tegs'>
{\$oticos_rand['tegs']}
<A href='game.php?game={\$oticos_rand['GameID']}'>Game Discription</A>
</td>
</tr>
</tbody></table></td>
<td width='150'><table border='0' cellpadding='0' cellspacing='0' height='75' width='100%'>
<tbody><tr>
<td rowspan='4' class='style24' background='images/line_up.jpg' height='75' width='10'> </td>
<td class='style24'>Added: <span class='style28'>
EOT;
$display .= '" . date(\'m/d/y\', strtotime( $oticos_rand[\'Date\'] )) . "</span>';
$display .= <<<EOT
</td>
</tr>
<tr>
<td class='style24'>From: <span class='style32'>{\$oticos_rand['from']}{\$oticos_search['Origin']}</span></td>
</tr>
<tr>
<td class='style24'>Played: <span class='style29'>{\$oticos_rand['Clickthrough']}</span></td>
</tr>
<tr>
<td class='style24'>
<span style='float: left;'>Ratings: </span>
EOT;
$display .= $rating;
$display .= <<<EOT
</td>
</tr>
</tbody></table></td>
</tr>
</tbody>
</table>
<div class='dotted' ></div>
EOT;
hiVis("oticos_rand", 0, $count, 1, $zapros, $display);
?>AND I want to change it to allow the use of this, which is some css and html code;
Code: Select all
<div class="game_view_layout">
<div class="game_image_view">
<div class="game_image">
<img src="images/img67.jpg" alt="" width="120" height="72" />
</div>
</div>
<div class="game_text_holder">
<div class="game_name">
<p> Emo Cupid </p>
</div>
<div class="game_description">
<p>Cupid Has Gone Emo. Dress Up The Emo Version Of Cupid Choosing From Many Different Types Of Clothes And Accessories. Remember To Give Cupid Her Bow...</p>
</div>
<div class="game_details">
<p> Ratings 12/23/09 1,000 views <span>Admin</span></p>
</div>
</div>
</div>Please Help If you could thanks