Web Analytics Made Easy -
StatCounter PHP Varibales and JavaScript - CodingForum

Announcement

Collapse
No announcement yet.

PHP Varibales and JavaScript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?
    LogoJive.com - Professional Grade Web Development!
    My Domain Listing: dnListing.com/listing/Unknown

  • #2
    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...

    Comment


    • #3
      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>
      LogoJive.com - Professional Grade Web Development!
      My Domain Listing: dnListing.com/listing/Unknown

      Comment

      Working...
      X