Jump to content


Photo

a little help


  • Please log in to reply
4 replies to this topic

#1 voyde

voyde
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 23 August 2006 - 08:01 AM

Using:
<table cellpadding='0' cellspacing='8' width='100%'>

<?php

do_event("gamepage");

$maxwidth = $games_config['maxgamewidth'];
$minwidth = $games_config['mingamewidth'];
$maxnopopwidth = $games_config['maxnopopwidth'];

$game = get_game("id="._sp($params[1])."&maxwidth="._sp($maxwidth)."&minwidth="._sp($minwidth));
$cfg['pagetitle'] = $game['name'];
$cfg['metakey'] = $game['keywords'];
$cfg['metadesc'] = $game['desc'];

$game['time'] = date("M d, Y", $game['time']);

?>

 <tr>
  <td width='100%' colspan='2' valign='top'>
   <div class='ocontentsection'>
    <div class='ocontenthead'>
     <?php

     echo "<a href='".get_category_link("name=".$game['cat'])."' class='topbarlink'>".$game['cat']."</a>";
     echo " &raquo; ";
     echo $game['name'];
     ?>
    </div>
    <div class='contenttext'>
     <center>

<?php


if ($game['type'] != 'extlink') {
	if ($game['width'] <= $maxnopopwidth) {
		echo $game['code']."<br /><br />";
		do_event("gameplay");
	} else {
		$link = get_play_link("id="._sp($params[1]));
		$width = $game['width'];
		$height = $game['height'];
		$link = "javascript:popup('".$link."', ".$width.", ".$height.")";
		echo "<br /><b><a href=\"".$link."\" class='darklink'>- Click Here to Play ".$game['name']." in a New Window -</a></b><br /><br />";
	}
} else {
	if (get_game_config("name=frameextlinks")==1) {
		$target = "";
	} else {
		$target = "target='_blank'";
	}

	echo "<br /><b><a href=\"".get_play_link("id="._sp($game['id']))."\" class='darklink' ".$target.">- Click Here to Play ".$game['name']." -</a></b><br /><br />";
}

?>

     <center>
    </div>
   </div>
  </div>
 </td>
</tr>

<tr>
 <td width='100%' colspan='2' valign='top'>
  <div class='ocontentsection'>
   <div class='ocontenthead'>Game Information</div>
   <div class='contenttext'>


<?php


echo "<table width='97%' class='contenttable'><tr><td width='50%' valign='top' align='left'>";
echo "<b>Date added:</b> ".$game['time']."<br />\n";
echo "<b>Play Count:</b> ".$game['playcount']."<br />\n";
if ($game['type'] == 'SWF' || $game['type'] == 'DCR') {
	echo "<b>File Size:</b> ".hfilesize($game['filename'])."<br />\n";
}

if ($game['authorname'] != '') {
	if ($game['authorsite'] == '') {
		echo "<b>Author:</b> ".$game['authorname']."<br />\n";
	} else {
		echo "<b>Author:</b> <a class='darklink' href='http://".$game['authorsite']."'>".$game['authorname']."</a><br />\n";
	}
} else if ($game['authorsite'] != '') {
	echo "<b>Author:</b> <a class='darklink' href='http://".$game['authorsite']."'>".$game['authorsite']."</a><br />\n";
}

if ($game['authorname']!='') {
	$authorlink = get_author_link("name=".$game['authorname']);
	echo "<a href='".$authorlink."'>View all games by this author...</a>";
	echo "<br />";
}


echo "<br /><b>Description:</b><br />";
echo $game['desc'];

if ($game['instructions'] != '') {
	echo "<br /><br /><b>Instructions:</b><br />";
	echo $game['instructions'];
}

if ($game['rating']!=0) {
	$ratingimg = "[themedir]ratings/".round($game['rating']/2)."stars.gif";
	echo "<br /><br /><b>Rating:</b><br /><img src='$ratingimg' />";
}


if (user_enabled()) {
	// favorites
	$user = get_logged_in_user();

	if ($user!='false') {

		echo "<br /><br />";

		if (is_favorite($game['id'])) {
			echo "<a class='darklink' href='".get_removefavorite_link("id=".$game['id'])."'>Remove From My Favorites</a>\n";
		} else {
			echo "<a class='darklink' href='".get_addfavorite_link("id=".$game['id'])."'>Add To My Favorites</a>\n";
		}

	}

}

//

if ((dispgamecode_enabled() && ($game['code']!='' || $game['disphtmlcode']!='')) || $game['disphtml'] == "Yes") {
	if ($game['disphtml'] != "No") {

		$gcode = $game['code']."<br /><center><a href='".get_home_link()."'>[sitetitle]</a></center>";

		if ($game['disphtmlcode']!='') {
			$gcode = $game['disphtmlcode'];
		}

		echo "<br /><br /><b>Add this game to your blog, MySpace, LiveJournal, or website!</b><br />";
		echo "<textarea rows='12' cols='36' style='font-size: 9px; font-family: Verdana;'>";
		echo myhtmlentities($gcode);
		echo "</textarea>";
	}

}

echo "</td><td width='50%' valign='top' align='left'>";


echo "<div style='padding-bottom: 4px;'><b>If you liked ".$game['name'].", you may also enjoy...</b></div>";

$q = "SELECT * FROM games WHERE cat='".$game['cat']."' AND id!='".$game['id']."' ORDER BY RAND() DESC LIMIT 0, ".$themecfg['similargamesnumber']."";
$games2 = get_games("shortdesc=".$themecfg['maxdesclength']."&htmlize=true&diffquery=".$q);

foreach ($games2 as $game2) {

	dispgametd(true, $game2);

//	$link = get_game_link("id="._sp($game2['id']));

//	echo "<table class='gltable' cellpadding='0' cellspacing='0'><tr><td><a href='".$link."' class='gamelink'><img src='[imgdir]".$game2['nameid'].".png' alt='".$game2['name']."' width='[twidth]' height='[theight]' class='gamethumb' align='left' /></a>
//	<a href='".$link."' class='gamelink'>".$game2['name']."</a><br />
//	".$game2['desc']."</td></tr></table>";
}

echo "</td></tr></table>";

if (theme_is_admin()) {
	echo theme_admin_link("Manage Games", "darklink", "games", "manage");
	echo " - ";
	echo theme_admin_link("Edit This Game", "darklink", "games", "editgame-form", "id=".$game['id']);
}

?>
   </div>
  </div>
  </div>
 </td>
</tr>

<?php

if (comments_enabled()) {

	?>

<tr>
 <td width='100%' colspan='2' valign='top'>
  <div class='ocontentsection'>
   <div class='ocontenthead'>Comments & Ratings</div>
   <div class='contenttext'>

	<?php
	$comments = get_comments("gid=".$game['id']);

	if (count($comments)==0) {
		echo "No comments yet - you can be the first!<br /><br />";
	}

	foreach ($comments as $comment) {

		$comment['time'] = date("M jS, Y @ H:i:s", $comment['date']);

		if ( !(  $user = get_user("id="._sp($comment['uid']))  ) ) {
			$username = 'Guest';
		} else {
			if (user_enabled()) {
				$username = $user['username'];
			} else {
				$username = 'Guest';
			}
		}

		if ($username != 'Guest') {
			$usernametext = "<a href='".get_profile_link("id="._sp($user["id"]))."' class='darklink'>".$username."</a>";
		} else {
			$usernametext = $username;
		}

		if (!user_enabled() && $usernametext=='Guest') {
			echo "<b>Posted on ";
			echo $comment['time']."</b>";
		} else {
			echo "<b>".$usernametext."</b>";
			echo " - ";
			echo $comment['time'];
		}

		if (theme_is_admin()) {
			echo " - ";
			echo theme_admin_link("Remove This Comment", "darklink", "comments", "delete-do", "id=".$comment['id'], true);
		}

		if ($comment['comment']!='') {
			echo "<br />Comment: ".$comment['comment'];
		}

		if ($comment['rating']!=0) {
			echo "<br />Rating: ".$comment['rating']."/10";
		}

		echo "<br /><br />";

	}

	echo "<div class='secline'>Add Your Own</div>";
	do_event("comment_form");

	?>

   </div>
  </div>
  </div>
 </td>
</tr>

	<?php
}

if (taf_enabled()) {

	if (taf_login_required()==false || get_logged_in_user()!=false) {
	?>
<tr>
 <td width='100%' colspan='2' valign='top'>
  <div class='ocontentsection'>
   <div class='ocontenthead'>Tell A Friend About <?php echo $game['name']; ?></div>
   <div class='contenttext'>

	<?php
	taf_form_display(get_game_link("id=".$game['id']));
	?>

   </div>
  </div>
  </div>
 </td>
</tr>

	<?php
	}
}
?>


</table>

This is a game page for Game site script, i wanna make a 10 second countdown till the game link, (Click here to play "game name" in a new window page) But whenever i write a php code inside the javascript ive been using it never works..

any suggestions...

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 23 August 2006 - 08:48 AM

can you be a bit more specific? are you saying you want to have a window popup after 10 seconds? you should be doing that with more javascript, not php inside javascript.  on that note, this has been moved to the javascript department.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 23 August 2006 - 11:37 AM

I can't say I clearly understood what you meant. You mean you want to add js codes with php?

then this is quite simple. use something like:
echo " < scr ipt lang uage=\"javas cript\">al ert('I\'m created by PHP')</sc ript>" ;

but if you intend to use a php code inside a js code like:
a l e r t ('<?php echo"I cannot be created"; ?>');

Don't waste your time. It will never work. JS is client side and PHP is server side scripting languages. So to use php codes you should have a server. This code can only work if you parse it in the server but it will give only something like:

al e r t('I cannot be created');

all the php things are gone. and just the text is left.

I hope it helps. If you can be more specific we can help you more.

Note: There is a problem with js posting I think, so the js codes are a little obfuscated.
Roy Simkes
Yet Another Parkyeri Developer

#4 voyde

voyde
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 23 August 2006 - 04:50 PM

I want the game to have to wait 10 seconds until its displayed (so i can show ads during the ten seconds)


 <tr>
  <td width='100%' colspan='2' valign='top'>
   <div class='ocontentsection'>
    <div class='ocontenthead'>
     <?php

     echo "<a href='".get_category_link("name=".$game['cat'])."' class='topbarlink'>".$game['cat']."</a>";
     echo " &raquo; ";
     echo $game['name'];
     ?>
    </div>
    <div class='contenttext'>
     <center>

<?php


if ($game['type'] != 'extlink') {
	if ($game['width'] <= $maxnopopwidth) {
		echo $game['code']."<br /><br />";
		do_event("gameplay");
	} else {
		$link = get_play_link("id="._sp($params[1]));
		$width = $game['width'];
		$height = $game['height'];
		$link = "javascript:popup('".$link."', ".$width.", ".$height.")";
		echo "<br /><b><a href=\"".$link."\" class='darklink'>- Click Here to Play ".$game['name']." in a New Window -</a></b><br /><br />";
	}
} else {
	if (get_game_config("name=frameextlinks")==1) {
		$target = "";
	} else {
		$target = "target='_blank'";
	}

	echo "<br /><b><a href=\"".get_play_link("id="._sp($game['id']))."\" class='darklink' ".$target.">- Click Here to Play ".$game['name']." -</a></b><br /><br />";
}

?>

     <center>
    </div>
   </div>
  </div>
 </td>
</tr>
To sum it all up, i need the content above to be displayed after 15 seconds.

thats all, but i cant figure it out

#5 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 23 August 2006 - 06:23 PM

you could try something like this:
$time = microtime(false);
for (;;)
{
if ( microtime(false) - $time > 15 )
break;
--show the ad
}
--show the page
[code]

I'm not quite sure about the microtime function by the way. check it's validity. Or an equivalent function which will store the time. [/code]

Roy Simkes
Yet Another Parkyeri Developer




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users