Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-11-2004, 11:47 PM   PM User | #1
Unknown
New Coder

 
Join Date: Jan 2004
Location: Illinois
Posts: 72
Thanks: 2
Thanked 0 Times in 0 Posts
Unknown is an unknown quantity at this point
PHP Varibales and JavaScript

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?
Unknown is offline   Reply With Quote
Old 02-11-2004, 11:53 PM   PM User | #2
Garadon
Regular Coder

 
Join Date: Jul 2002
Posts: 698
Thanks: 0
Thanked 0 Times in 0 Posts
Garadon is an unknown quantity at this point
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...
Garadon is offline   Reply With Quote
Old 02-12-2004, 12:02 AM   PM User | #3
Unknown
New Coder

 
Join Date: Jan 2004
Location: Illinois
Posts: 72
Thanks: 2
Thanked 0 Times in 0 Posts
Unknown is an unknown quantity at this point
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>
Unknown is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:40 AM.


Advertisement
Log in to turn off these ads.