Page 1 of 1
Jquery conflict with CCounter?
Posted: Sun Mar 15, 2015 8:27 pm
by henryconcise
We are using your ccounter script on a JQuery DataTable - and long story short - it populates the table but the table wont sort the output....
I think it is because this JQuery doesnt like this string: <script>ccount_display('XXXX')</script><
Here's the demo -
https://www.concise-courses.com/hacking-tools/e.html (view source)
Any idea/ suggestions?
Thanks VERY much as ever!
PS here is the DataTables JQuery -
http://www.datatables.net/
Re: Jquery conflict with CCounter?
Posted: Mon Mar 16, 2015 2:20 am
by Henrie
It seems JQuery does like the string <script>ccount_display('XXXX')</script>
It just uses this string literally and does not use the values that are returned by the script.
I do not have a working solution for you, but I think you should create a php page that reads the CCount database file and displays it's values so that jquery gets actual values instead of the <script>ccount_display('XXXX')</script> string.
To achieve what you want you can probably use some of the code that is already used by the ccount script.
Option 1:
Use code inside the admin.php file because that already has the capabalities to display all the values and sort the columns (it seems to use jquery.tablesorter).
You would have to find a way to add your own columns 'Category', 'Name of Hacking Tool' and 'Tutorial Link' though.
So I guess it is not a very easy task.
Otion 2 (I thought of this after I wrote option 1):
Use the code inside display.php.
It contains the code that is used by the <script>ccount_display('XXXX')</script> so I think can you use this code (with some tweaking) to display the ccount links directly in a php page instead of using javascript.
I just can not tell you what you would have to tweak exactly because I have never tried to use it this way.
Maybe Klemen can give you more to the point advise because this is his script and he knows better how it works than I do (it would take me several hours of trial and error tweaking because I just know the basics of php and javascript and are not a real programmer).
Greetings,
Henrie
Re: Jquery conflict with CCounter?
Posted: Mon Mar 16, 2015 8:57 am
by Klemen
Just like Henrie said, table gets sorted by the string inside <td>, not by the value returned by ccount_display function.
The easiest and most reliable way around it would be to use a server-side script (PHP) to read display values from CCount database and populate the table with integers, rather than JS (Henrie's option 2).
Re: Jquery conflict with CCounter?
Posted: Mon Mar 16, 2015 9:53 am
by henryconcise
Thanks guys -
I don't have the skill to write this code -
If either of you are able to write me a script (obviously I'll pay for your time) that would be great. Let me contact you offline.
Alternatively - if you know of anyone that might be able to help that would be awesome - thanks again.
Re: Jquery conflict with CCounter?
Posted: Mon Mar 16, 2015 4:01 pm
by Klemen
I am not available for hire at the moment, but you can for example hire a coder
here.
This should be a straight-forward job for someone experienced with PHP:
1. read everything after // from the database file
2. unserialize
3. for each id of the array print the "C" key value for clicks and/or "U" key value for unique clicks