...

View Full Version : PHP Varibales and JavaScript



Unknown
02-11-2004, 11:47 PM
I'm trying to use an already set php vairable in javascript in an if statment. Here is the code.

if (top.window.document.title !={SITENAME} :: {PAGE_TITLE})
{
top.window.document.title={SITENAME} :: {PAGE_TITLE}
}
</script>

But as you can see it wont' work because the if statment thinks that the } in {SITENAME} :: {PAGE_TITLE} is suopposed to end the if statment. Anyone can help?

Garadon
02-11-2004, 11:53 PM
I usually do

<? print($VARIABLE_NAME);?>


and importants thing to remember is that all php code is done 1st
then send to the client that then does the html/havascript code.

it is not all done line by line simultanously...

Unknown
02-12-2004, 12:02 AM
Well {SITENAME} and {PAGE_TITLE} are set by phpBB. They value they store depends on the value that they are given in the admin CP. Anyone know how to use them exactly as they are in javascript. Or can anyone give me a php script that does the same as this:
if (top.window.document.title !={SITENAME} :: {PAGE_TITLE})
{
top.window.document.title={SITENAME} :: {PAGE_TITLE}
}
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum