Jump to content

Need help with a script...


JeWeLS

Recommended Posts

k. so I found this php click counter, and I can't get it to display. I can't figure out why. I have read the readme, and did what it said, and put the codings in correctly but i don't know why its not displaying the clicks. I'm not sure If i should move the script folder to the location of the journal (where my site is technically at). I have the script folder in my public_html folder right now. You can see & get the script here: phpjunkyard.com Here is where I was trying to get the click counter to show up @:I wanted it to show up underneath the "Register here" link.

Link to comment
Share on other sites

It looks like you have a javascript error on the page:

http://www.loveju1ie.com/journal/?page_id=18Unknown contextSyntax error while loading: line 1 of inline script at http://www.loveju1ie.com/journal/?page_id=18 : ccount_display(& #8217;5& #8242;)
<script language="Javascript">ccount_display(& #8217;5& #8242;)</script>What are you trying to do with that function, why do you have the entity codes there? It looks like you are trying to give the function 2 entity codes and a 5 in the middle. You can try quoting the whole thing and see if that works:ccount_display("& #8217;5& #8242;")But I think it is probably something else.Actually, looking at the page for the counter, I think you are trying to do this:ccount_display("5")Those two codes (#8217 and #8242) represent quote-like characters, so I assume you were just trying to give the function the number 5, which does go in quotes (actual quotes like I have above, not the character codes for characters that look like quotes).This is what the two characters look like around the 5. They look like quotes, but they aren't.’5′ note: I had to put a space after each &, because it was trying to show the characters instead of show the code. In actuality there is no space there
Link to comment
Share on other sites

It looks like you have a javascript error on the page:<script language="Javascript">ccount_display(& #8217;5& #8242;)</script>What are you trying to do with that function, why do you have the entity codes there?  It looks like you are trying to give the function 2 entity codes and a 5 in the middle.  You can try quoting the whole thing and see if that works:ccount_display("& #8217;5& #8242;")But I think it is probably something else.Actually, looking at the page for the counter, I think you are trying to do this:ccount_display("5")Those two codes (#8217 and #8242) represent quote-like characters, so I assume you were just trying to give the function the number 5, which does go in quotes (actual quotes like I have above, not the character codes for characters that look like quotes).This is what the two characters look like around the 5.  They look like quotes, but they aren't.’5′ note: I had to put a space after each &, because it was trying to show the characters instead of show the code.  In actuality there is no space there

Edit: I changed it again, and the script still isn't showing. :) I have it like this:<font color="aquamarine"><script language="Javascript">ccount_display("5")</script></font>
Link to comment
Share on other sites

The page is still showing the same javascript error:

http://www.loveju1ie.com/journal/?page_id=18Unknown contextSyntax error while loading: line 1 of inline script at http://www.loveju1ie.com/journal/?page_id=18 : ccount_display(& #8221;5& #8243;)-----------------^

It still has the entity characters there instead of quotes (only they are different entities, now they look like double quotes). Are you using a normal text editor to make your changes, or do you have some web interface that you use to change the code?The code is pretty fractured, there is stuff scattered all over the place that should probably be in the head. I can't tell if you are including the script to actually make the counter work (the script that defines the ccount_display function). So make sure you have a reference to whatever javascript or PHP file contains the ccount_display function, and make sure that you have quotes around the parameter.

Link to comment
Share on other sites

The page is still showing the same javascript error:
http://www.loveju1ie.com/journal/?page_id=18Unknown contextSyntax error while loading: line 1 of inline script at http://www.loveju1ie.com/journal/?page_id=18 : ccount_display(& #8221;5& #8243;)-----------------^

It still has the entity characters there instead of quotes.  Are you using a normal text editor to make your changes, or do you have some web interface that you use to change the code?The code is pretty fractured, there is stuff scattered all over the place that should probably be in the head.  I can't tell if you are including the script to actually make the counter work (the script that defines the ccount_display function).  So make sure you have a reference to whatever javascript or PHP file contains the ccount_display function, and make sure that you have quotes around the parameter.

hmm. I'm not sure what i'm doing wrong. I tried doing the quotes both ways and it still doesn't show the counter. I'm not using any text editor. I just edit the pages manually through the wordpress pages. I haven't had any trouble with javascript on my site until just recently. :) I have the script code on my index page 4 the journal, but not on the page that I want the counter to show up at.
Link to comment
Share on other sites

Wordpress is probably converting all of your double quotes into "nicer looking" slanted double-quote looking characters. If you can connect to your site and download your file through FTP and then just change it with a text editor, I'm sure it would work. Or there might be a way to instruct Wordpress not to do that.

Link to comment
Share on other sites

Wordpress is probably converting all of your double quotes into "nicer looking" slanted double-quote looking characters.  If you can connect to your site and download your file through FTP and then just change it with a text editor, I'm sure it would work.  Or there might be a way to instruct Wordpress not to do that.

Edit: I found this: http://codex.wordpress.org/Using_JavascriptI don't know if that will fix my problem or not, what do you think? Edited by JeWeLS
Link to comment
Share on other sites

Well, I've never used Wordpress so someone else might have better information. But this may be of help:

If you are having trouble with including Javascripts inside a post, use the Text Control Plugin which allows you to control on a global or per post basis the ability to turn off WordPress' automatic formatting features which can quickly turn code into something readable instead of executable. Set the options on the post that you will be using the Javascript on to have No Formatting or Markup or nl2br and No Character Formatting. You may have to experiment to get it to work. As a reminder, when using the Text Control Plugin, you must first Save and Continue Editing the post in order to see the Text Control Plugin options. If you choose No Formatting, your post's text will run together, so you will have to add paragraph tags and other HTML tags in order to format your page as WordPress normally does that for you. If your Javascript does not work, triple check that you have not made any errors during the cut and paste into a group or single file. Be sure you used a text editor and not a word processing program to create the Javascript file.
I guess the question is whether or not this is a "post". I'm just not real sure how Wordpress works and how you edit pages or what it does to the text you type in. But I know that if you are able to save the source file and then edit it yourself, that will work.
Link to comment
Share on other sites

Well, I've never used Wordpress so someone else might have better information.  But this may be of help:I guess the question is whether or not this is a "post".  I'm just not real sure how Wordpress works and how you edit pages or what it does to the text you type in.  But I know that if you are able to save the source file and then edit it yourself, that will work.

Yeah, every page is considered a "post". I can't modify wordpress's pages manually with a text editor. Wordpress is kinda complicating sometimes.
Link to comment
Share on other sites

I can't modify wordpress's pages manually with a text editor.

Well, you can if you have access to the PHP source. If you do, I could help you add what you needed there. Otherwise, there should be a way somewhere to disable the formatting that Wordpress does.
Link to comment
Share on other sites

Well, you can if you have access to the PHP source.  If you do, I could help you add what you needed there.  Otherwise, there should be a way somewhere to disable the formatting that Wordpress does.

Edit: I found this: http://codex.wordpress.org/Writing_Code_in_Your_PostsI just went to the page and did the "view source", so I'm not really sure as to how to get to the page by FTP if that is what you are saying. I downloaded that plugin, and it still doesn't fix the problem. I'm sure there is a way to disable the formatting that wordpress does, i'm just not sure where to find it.
Link to comment
Share on other sites

You might ask on a Wordpress forum somewhere, tell them you are trying to include a javascript function call that includes quotes, and Wordpress keeps converting them to entity codes. Or you can refer them to this thread. But view source won't do the trick, the code you see there is the result of the PHP code, not the PHP code itself. If you have access to the server that you are hosted on, like through an administrator control panel or through an FTP client, then you can transfer the PHP file to your computer. But if you don't have that access, you will probably need to seek help from Wordpress users.

Link to comment
Share on other sites

Hmm, like I said, I'm not sure how Wordpress works, but you might try this:Change this:

ccount_display("5")

into this:

<code>ccount_display("5")</code>

But that's a long shot, it probably won't work.wait, hold on, that's not rightI can't get the character codes to show up in this post, it keeps translating them to the actual characters.In my second chunk above, replace the quotes with & followed by #34;so it should look like this, but without the space: & #34;

Link to comment
Share on other sites

Hmm, like I said, I'm not sure how Wordpress works, but you might try this:Change this:
ccount_display("5")

into this:

<code>ccount_display("5")</code>

But that's a long shot, it probably won't work.wait, hold on, that's not right

k. I'll give that a shot. If not, I will ask for wordpress support on irc or something.
Link to comment
Share on other sites

Hmm, like I said, I'm not sure how Wordpress works, but you might try this:Change this:
ccount_display("5")

into this:

<code>ccount_display("5")</code>

But that's a long shot, it probably won't work.wait, hold on, that's not rightI can't get the character codes to show up in this post, it keeps translating them to the actual characters.In my second chunk above, replace the quotes with & followed by #34;so it should look like this, but without the space: & #34;

K. Here is what I have: <script language="Javascript"><code>ccount_display("5")</code></script></font>
Link to comment
Share on other sites

That's right, but replace those quotes with the character code & #34; (without the space). You probably wrote that, but the forum software won't escape the ampersand, and if I write &#34; it decides not to convert the ampersand code.How about this:&#34;Hey, that works. That is the character code to replace the quotes with:&#34;But first try only replacing the quotes around the 5, not the java script:<script language="Javascript"><code>ccount_display(&#34;5&#34;)</code></script>

Link to comment
Share on other sites

That's right, but replace those quotes with the character code & #34; (without the space).  You probably wrote that, but the forum software won't escape the ampersand, and if I write &#34; it decides not to convert the ampersand code.How about this:"Hey, that works.  That is the character code to replace the quotes with:"But first try only replacing the quotes around the 5, not the java script:<script language="Javascript"><code>ccount_display("5")</code></script>

K. Wanna take a look and see if i did it correctly?I would ask on the wordpress support forum, but whenever i post there, i get 0 help at all. I didn't get any help on they're support irc server either. :)
Link to comment
Share on other sites

OK, that works, we're making progress:

Soakin' up the Sun'http://www.loveju1ie.com/journal/?page_id=18Inline script threadError:name: ReferenceErrormessage: Statement on line 1: Reference to undefined variable: ccount_displayBacktrace:  Line 1 of inline#15 script in http://www.loveju1ie.com/journal/?page_id=18    ccount_display("5");
The quotes work, the code looks good. The problem now is that the function is not defined, so all you need to do is include a reference to the code for ccount. On the PHPjunkyard link you posted above, it looks like they have this to include the code:<script language="Javascript" src="http://www.phpjunkyard.com/ccount/display.php"></script>If you have that display.php file on your own server then you can add a tag like this to point there, or else you can probably cheat and use the phpjunkyard version. In that case, you would use the exact same code, but it's probably better if you use your own copy, just so that you know it won't change. The tag above needs to go anywhere in the page before the call to ccount_display. That should get everything working correctly.
Link to comment
Share on other sites

OK, that works, we're making progress:The quotes work, the code looks good.  The problem now is that the function is not defined, so all you need to do is include a reference to the code for ccount.  On the PHPjunkyard link you posted above, it looks like they have this to include the code:<script language="Javascript" src="http://www.phpjunkyard.com/ccount/display.php"></script>If you have that display.php file on your own server then you can add a tag like this to point there, or else you can probably cheat and use the phpjunkyard version.  In that case, you would use the exact same code, but it's probably better if you use your own copy, just so that you know it won't change.  The tag above needs to go anywhere in the page before the call to ccount_display.  That should get everything working correctly.

Edit: I tried it, and it still doesn't show. :)Yeah. I think you are right. I need to put the above script before the display script. I also asked for help on the wordpress forum and one guy gave me a plugin to use for the scripts to show up, and to edit my scripts, and I have done so but they stil arent's showing up. I think its because of ccount/display.php wasn't in the heading of where I want the display to show up at. I hope that makes sense. Edited by JeWeLS
Link to comment
Share on other sites

Actually, it looks like you can't use their script, you need to use your own. If you go to that display.php, you see this:

var ccount_link = new Array();ccount_link[12]=1359;ccount_link[13]=32091;ccount_link[15]=479;ccount_link[16]=2314;ccount_link[17]=27;ccount_link[18]=3;ccount_link[19]=548;function ccount_display(id){document.write(ccount_link[id]);}

Obviously, there is no "5" in there, so your call to find 5 won't work, and even if it did, they wouldn't be your numbers. So you will need to find where you have the display.php script installed and point your script tag there. If you need a place to put display.php, I can probably give you one.Actually, I'm a little retarded today. You don't just need the display.php file, you need the entire ccount installation somewhere that you can use.

Link to comment
Share on other sites

Actually, it looks like you can't use their script, you need to use your own.  If you go to that display.php, you see this:
var ccount_link = new Array();ccount_link[12]=1359;ccount_link[13]=32091;ccount_link[15]=479;ccount_link[16]=2314;ccount_link[17]=27;ccount_link[18]=3;ccount_link[19]=548;function ccount_display(id){document.write(ccount_link[id]);}

Obviously, there is no "5" in there, so your call to find 5 won't work, and even if it did, they wouldn't be your numbers.  So you will need to find where you have the display.php script installed and point your script tag there.  If you need a place to put display.php, I can probably give you one.Actually, I'm a little retarded today.  You don't just need the display.php file, you need the entire ccount installation somewhere that you can use.

I can PM you and tell you where I have the ccount installed @ on my site. I had no idea that the script itself was the problem as the cause of the script not displaying on the page.
Link to comment
Share on other sites

You can PM me if you want to, but all you need to know is the location of the display.php page. Substitute that address into this:<script language="Javascript" src="http://www.phpjunkyard.com/ccount/display.php"></script>Which needs to go before this:<script language="Javascript">ccount_display("5")</script>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...