PHP/Javscript Oddly not working

Soldato
Joined
9 Dec 2006
Posts
9,287
Location
@ManCave
So im editing a forum theme to work slighty differently.

Added
PHP:
$screenWidth = '<script type="text/javascript">document.write(screen.availWidth);</script>';

Then put into the global variables as inside a Function.
PHP:
if ($screenWidth > 900)
		{
			echo '

							<li class="avatar">

								<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">

									', $message['member']['avatar']['image'], '

								</a>

							</li>';
			
		}
		else
		{
			//echo'';
			//print 'Hello'.$screenWidth;
			

			
		}

Now it not working :(

What results am i getting?

if ($screenWidth > 900)
gives me no avaters but result of 2560
if ($screenWidth < 900)
gives me avaters but result of 2560..



if i print $screenwidth inside the function it gives me the correct value.
2560

So 2560 is greater than 900 so should show avaters.

I tried it around the other way
so 2560 < 900 & it displays afters
 
Soldato
OP
Joined
9 Dec 2006
Posts
9,287
Location
@ManCave
seem smf does not like it

arse error: syntax error, unexpected end of file in .../Themes/Reseller/Display.template.php on line 890
881: ]
882: });';
883: }
884: }
885:
886: echo '
887: // ]]></script>';
888: }
889:
890: ?>
891:
892:

i edited line 400 lol
 
Back
Top Bottom