*

Recent

Author Topic: rating update  (Read 12910 times)

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: rating update
« Reply #30 on: October 30, 2011, 01:51:29 PM »
Doing it that way causes 2 things though. First, it does not allow for putting the script in a folder of the root of the site. Second, it does not allow for the changing of the rating images with different templates, which we are working towards allowing members to choose their own at some point. We have to have it set up so that it points to the template folder images where ever it is. I'll keep chewing on it.

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Re: rating update
« Reply #31 on: October 30, 2011, 04:06:06 PM »
You have two choices:

1. Put the images in /images.

2. Put the js file (As .js preferably) in the template folder of the theme.

And this probably says it better than I can.

Quote
Javascript and PHP ARE NOT THE SAME. You're thinking, duh! obviously but I mean Javascript is a "client side" technology while PHP is a "server side" technology.

Your Javascript can read from PHP variables only because the .php page is being processes on the server "first" and the output returned. Hence any variables will be output into the JS.

However, the reverse is NOT true. Your Javascript does not have access to any PHP information as it resides on the server. The only way you can make JS variables accessible to PHP is to make POST or GET back to the server (call the .php again) with the required variables+values.