voyde Posted August 23, 2006 Share Posted August 23, 2006 Using:[code]<table cellpadding='0' cellspacing='8' width='100%'><?phpdo_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 " » "; echo $game['name']; ?> </div> <div class='contenttext'> <center><?phpif ($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'><?phpecho "<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><?phpif (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>[/code]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... Quote Link to comment Share on other sites More sharing options...
.josh Posted August 23, 2006 Share Posted August 23, 2006 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. Quote Link to comment Share on other sites More sharing options...
radalin Posted August 23, 2006 Share Posted August 23, 2006 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:[code]echo " < scr ipt lang uage=\"javas cript\">al ert('I\'m created by PHP')</sc ript>" ;[/code]but if you intend to use a php code inside a js code like:[code]a l e r t ('<?php echo"I cannot be created"; ?>');[/code]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:[code]al e r t('I cannot be created');[/code]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. Quote Link to comment Share on other sites More sharing options...
voyde Posted August 23, 2006 Author Share Posted August 23, 2006 I want the game to have to wait 10 seconds until its displayed (so i can show ads during the ten seconds)[code] <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 " » "; echo $game['name']; ?> </div> <div class='contenttext'> <center><?phpif ($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>[/code]To sum it all up, i need the content above to be displayed after 15 seconds.thats all, but i cant figure it out Quote Link to comment Share on other sites More sharing options...
radalin Posted August 23, 2006 Share Posted August 23, 2006 you could try something like this:[code]$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][/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.