• Need help with HTML loading screen
    6 replies, posted
Let me start off by saying I am very new to HTML. The only reason I started learning it was because I want to make a neat looking loading screen for my Garry's Mod TTT server. Everything looks OK except in the middle its supposed to say: [CODE]Welcome, (steam name) Steam ID: (steam id) We are playing map (map name) Have fun![/CODE] But instead it reads: [CODE]; echo "Steam ID: $steamid" ; echo "We are playing map $mapname!" ; echo "Have fun!"; ?>[/CODE] For some reason it doesn't even display the first line in my <?php section. Here's the full code: [CODE]<html> <head> <?php $communityid = $_GET["user"]; $mapname = $_GET["mapname"]; $authserver = bcsub( $communityid, '76561197960265728' ) & 1; $authid = (bcsub( $communityid, '76561197960265728' ) - $authserver ) / 2; $steamid = "STEAM_0:$authserver:$authid"; $link = file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=(my api key is here)&steamids=' . $steamid . '&format=json'); $myarray = json_decode($link, true); ?> </head> <body background="http://i.imgur.com/8ZLiS6W.jpg"> <div id="userinfo" style="position: absolute; top: 322px; left: 414px; font-family: Impact, Charcoal, sans-serif; font-size: 20pt; color: #848484;"> <?php echo "Welcome, $communityid!" <br/>; echo "Steam ID: $steamid" <br/>; echo "We are playing map $mapname!" <br/>; echo "Have fun!"; ?> </div> <object style="height: 0px; width: 0px"><param name="movie" value="http://www.youtube.com/v/DrWpLS0vM0g?version=3&feature=player_detailpage&autoplay=1&loop=1"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/DrWpLS0vM0g?version=3&feature=player_detailpage&autoplay=1&loop=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="1" height="0"></object> <div style="float:right;"> <a href="http://steamsignature.com"><img src="http://steamsignature.com/status/english/76561198079478620.png" alt="" title="" /></a><a href="steam://friends/add/76561198079478620"><img src="http://steamsignature.com/AddFriend.png" alt="" title="" /></a> </div> <div style="font-family: Impact, Charcoal, sans-serif; font-size: 20pt;"> Visit us on the web! http://EnergiZed-Gaming.com/ </div> <div style="position: absolute; top: 675px; left: 390px; font-family: Impact, Charcoal, sans-serif; font-size: 20pt;"> Now Playing : Holiday - Green Day </body> </html>[/CODE] I apologize for the inconvenience if the answer is really obvious, once again I am a noob at this kind of thing ;) Any help is appreciated! -Luke
The first thing that I saw was wrong was that you put the br tags outside of the strings. I wonder why it even showed anything. Here is a working code: [code] <html> <head> <?php $communityid = $_GET["user"]; $mapname = $_GET["mapname"]; $authserver = bcsub( $communityid, '76561197960265728' ) & 1; $authid = (bcsub( $communityid, '76561197960265728' ) - $authserver ) / 2; $steamid = "STEAM_0:$authserver:$authid"; $link = file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=(my api key is here)&steamids=' . $steamid . '&format=json'); $myarray = json_decode($link, true); ?> </head> <body background="http://i.imgur.com/8ZLiS6W.jpg"> <div id="userinfo" style="position: absolute; top: 322px; left: 414px; font-family: Impact, Charcoal, sans-serif; font-size: 20pt; color: #848484;"> <?php echo "Welcome, {$communityid}!<br/>"; echo "Steam ID: {$steamid}<br/>" ; echo "We are playing map {$mapname}!<br/>" ; echo "Have fun!"; ?> </div> <object style="height: 0px; width: 0px"> <param name="movie" value="http://www.youtube.com/v/DrWpLS0vM0g?version=3&feature=player_detailpage&autoplay=1&loop=1"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/DrWpLS0vM0g?version=3&feature=player_detailpage&autoplay=1&loop=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="1" height="0"> </object> <div style="float:right;"> <a href="http://steamsignature.com"> <img src="http://steamsignature.com/status/english/76561198079478620.png" alt="" title="" /> </a> <a href="steam://friends/add/76561198079478620"> <img src="http://steamsignature.com/AddFriend.png" alt="" title="" /> </a> </div> <div style="font-family: Impact, Charcoal, sans-serif; font-size: 20pt;"> Visit us on the web! http://EnergiZed-Gaming.com/ </div> <div style="position: absolute; top: 675px; left: 390px; font-family: Impact, Charcoal, sans-serif; font-size: 20pt;"> Now Playing : Holiday - Green Day </div> </body> </html> [/code] My next questions are. What did you call the file? Where do you host it?
Are you trying to place this on your Wix site?
[QUOTE=commander204;44317024]The first thing that I saw was wrong was that you put the br tags outside of the strings. I wonder why it even showed anything. Here is a working code: [code] <html> <head> <?php $communityid = $_GET["user"]; $mapname = $_GET["mapname"]; $authserver = bcsub( $communityid, '76561197960265728' ) & 1; $authid = (bcsub( $communityid, '76561197960265728' ) - $authserver ) / 2; $steamid = "STEAM_0:$authserver:$authid"; $link = file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=(my api key is here)&steamids=' . $steamid . '&format=json'); $myarray = json_decode($link, true); ?> </head> <body background="http://i.imgur.com/8ZLiS6W.jpg"> <div id="userinfo" style="position: absolute; top: 322px; left: 414px; font-family: Impact, Charcoal, sans-serif; font-size: 20pt; color: #848484;"> <?php echo "Welcome, {$communityid}!<br/>"; echo "Steam ID: {$steamid}<br/>" ; echo "We are playing map {$mapname}!<br/>" ; echo "Have fun!"; ?> </div> <object style="height: 0px; width: 0px"> <param name="movie" value="http://www.youtube.com/v/DrWpLS0vM0g?version=3&feature=player_detailpage&autoplay=1&loop=1"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/DrWpLS0vM0g?version=3&feature=player_detailpage&autoplay=1&loop=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="1" height="0"> </object> <div style="float:right;"> <a href="http://steamsignature.com"> <img src="http://steamsignature.com/status/english/76561198079478620.png" alt="" title="" /> </a> <a href="steam://friends/add/76561198079478620"> <img src="http://steamsignature.com/AddFriend.png" alt="" title="" /> </a> </div> <div style="font-family: Impact, Charcoal, sans-serif; font-size: 20pt;"> Visit us on the web! http://EnergiZed-Gaming.com/ </div> <div style="position: absolute; top: 675px; left: 390px; font-family: Impact, Charcoal, sans-serif; font-size: 20pt;"> Now Playing : Holiday - Green Day </div> </body> </html> [/code] My next questions are. What did you call the file? Where do you host it?[/QUOTE] Well I just named it screen.html and opened it with Google Chrome... I wanted to make sure it worked before hosting it. After changing that it still doesn't display what I'd like it to. It just says: [code]"; echo "Steam ID: {$steamid} " ; echo "We are playing map {$mapname}! " ; echo "Have fun!"; ?>[/code] EDIT: I found something: when I put all the echo's into a single line it fixes one of the problems. [code]<?php echo "Welcome, {$communityid}!<br/> Steam ID: {$steamid}<br/> We are playing map {$mapname}!<br/> Have fun!" ?>[/code] The thing is, when I try that it still doesn't show the first line and it has ?> at the end... [code]Steam ID: {$steamid} We are playing map {$mapname}! Have fun!" ?>[/code] I just need to get the first line to display and get rid of the ?> at the end...
It's strange that it's not printing the entire page, in fact. It has php content, so obviously, it should have the .php extension.
[QUOTE=Coment;44321299]It's strange that it's not printing the entire page, in fact. It has php content, so obviously, it should have the .php extension.[/QUOTE] I've tried saving it as a php file and the same exact issue occurs.
[QUOTE=lukectn;44321335]I've tried saving it as a php file and the same exact issue occurs.[/QUOTE] PHP files are first handled by a server. This server runs through it and does whatever is between <?php ?> tags. You need a server with PHP (lots of them on the internet) for that code to be read. Your browser only will try to run whatever is inside (parsing HTML, the only thing that it understands).
Sorry, you need to Log In to post a reply to this thread.