 | |  |
 |

Lionel
User
Jan 28, 2003, 12:23 PM
Post #1 of 18
(10917 views)
Shortcut
|
|
addon: most read articles (requires php and mysql)
|
Can't Post
|
|
the attached counter is not from me. I simply modified it to also display the title. I you want to use it, simply place '<img src="counter.php">' in your articles templates. This counter checks if a page exists, if not it inserts it in database. If it does, it increments the page hits. Now, this counter as is will only display the url. What I did, was to create 2 files from counter.php and not password protected them within the program, one for admin with reset and delete, and a modified one to display to public. I placed the admin file in an .htaccess password directory. My modifications to also display the linked article title in the second file which I call views php, replace the entire function function viewStatus($self,$password) with function viewStatus($self,$password) { if (authUser($password)) { $queryGetData = "SELECT * FROM pagecounter order by visits DESC LIMIT 5"; //set your own LIMIT by replacing the 5 $resultGetData = mysql_db_query(DATABASE, $queryGetData) or die ("Query failed: error was ".mysql_error()); $o .=" <table width=100%>\n"; $o .=" <tr>\n"; $o .=" <td width=\"100%\">\n"; $o .=" <font face=verdana size=3 color=#990000><b>Most read articles</b><font>\n"; $o .=" </td>\n"; $o .=" </tr>\n"; for($i=0;$row=mysql_fetch_array($resultGetData);$i++) { //haitiwebs addon $fd= fread(fopen("$row[page]", "r"), 100000); if ($fd) { $start= strpos($fd, "<title>"); $finish= strpos($fd, "</title>"); $length= $finish-$start; $code_grabbed=Substr($fd, $start, $length); $title=str_replace("<title>", "", $code_grabbed); } $i % 2 ? 0: $bgcolor = "#ebebeb"; $o .=" <tr bgcolor=\"$bgcolor\">\n"; $o .=" <td>\n"; $o .=" <li><font face=verdana size=1><a href=$row[page]><b>$title</b></a></font></li>\n"; $o .=" </td>\n"; $o .=" </tr>\n"; } $o .=" </table>\n"; if (mysql_num_rows($resultGetData) == "0") { return "There are no active counters.\n"; } else { return $o; } } else { $o .=" <form action=\"$self\" method=post>\n"; $o .=" Password:\n"; $o .=" <input name=\"password\" type=\"password\" /> \n"; $o .=" <input type=hidden name=a value=vs>\n"; $o .=" </form>\n"; return $o; } } you can view it in action at http://www.haitiwebs.com/magazine/articles/top.php or http://www.haitiwebs.com/magazine/articles/top.shtml whichever you want. This is my first public addon, hope someone will find it useful. That test article http://www.haitiwebs.com/magazine/articles/article_117.php is loaded with goodies. Although that one hasn't got one, every article can include its own interactive poll. Email or post here if interested.
(This post was edited by Lionel on Mar 13, 2003, 9:02 PM)
|
|
Attachments:
|
counter.txt
(6.19 KB)
|
|
|  |
 |

MalaK_3araby
User
Jan 28, 2003, 2:30 PM
Post #2 of 18
(10906 views)
Shortcut
|
|
Re: [Lionel] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Hello Lionel. Many Thanks for releasing this ADDON. it looks beautiful that i hope it would be in V2 by default. Time .. time .. time is my problem. I will surely try to install this one and play with it. Thanks again and keep'em coming. Oh and thanks for the counter. -------------- Sure you can spell it, but do you get it?
|
|
|  |
 |

Benjamin
Staff

Jan 29, 2003, 3:10 PM
Post #3 of 18
(10878 views)
Shortcut
|
|
Re: [MalaK_3araby] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Great, Lionel! Thanks very much for your add-on. Keep 'em coming Ben interactivetools.com
|
|
|  |
 |

jmueller0823
User
Mar 13, 2003, 11:45 AM
Post #4 of 18
(10644 views)
Shortcut
|
|
Re: [Benjamin] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Lionel Your example link: http://www.haitiwebs.com/magazine/articles/top.shtml Isn't functional. Has the link changed? Also, could you attached the actual php files(s), please? Thanks. Jim g r o w t h t r a c dot c o m Life Changing Resources for Your Marriage
|
|
|  |
 |

Lionel
User
Mar 13, 2003, 8:59 PM
Post #6 of 18
(10635 views)
Shortcut
|
|
Re: [jmueller0823] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
hum, I fixed it... A quick look in db gave me the explanation. I was fooling around with an automatic translator to translate my french pages in english, and that translator was adding illegal characters in the db, such as magazine/articles/article_76.php&prev=/search%3Fq%3Dchad%25C3%25A8que%26hl%3Dfr%26lr%3D%26ie%3DUTF-8
|
|
|  |
 |

Lionel
User
Mar 13, 2003, 9:08 PM
Post #7 of 18
(10633 views)
Shortcut
|
|
Re: [jmueller0823] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
here you go. Right click in the attachment on the first post and save. Rename it counter.php. Create db as in the file, input your dbnane and db password stuff etc..., then upload to server. That's for admin Do the same for the attached file, except there is no need to create the db again and live admin password blank Upload both files in a folder called counter under your publish articles folder display views.php as per example on first post, e.g. if shtml <!--#include virtual="counter/views.php?a=vs" --> I forgot to add: This hack assumes that you are using your articles name in the <title> </title> tag. This is where it is grabbing the article name to make the conversion. So make sure that you have the AM article name tag in there, or there will be nothing to read.
(This post was edited by Lionel on Mar 13, 2003, 9:23 PM)
|
|
Attachments:
|
views.php.txt
(5.57 KB)
|
|
|  |
 |

jmueller0823
User
Mar 14, 2003, 6:57 AM
Post #8 of 18
(10624 views)
Shortcut
|
|
Re: [Lionel] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Lionel, thanks. It appears your URL, http://www.haitiwebs.com/magazine/articles/top.php, is still not functional -- no data. Also, all of our pages are currently "shtml". Will server side includes work with php pages? Thanks again. Jim g r o w t h t r a c dot c o m Life Changing Resources for Your Marriage
|
|
|  |
 |

ivar
User
Sep 17, 2003, 8:23 AM
Post #9 of 18
(10349 views)
Shortcut
|
|
Re: [Lionel] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Hi, great script, but I can't get it to work. I've created the database, and so on, but I keep getting the message "There are no active counters." What's missing; is there a way to activate the script or what could be wrong? PLease help me! Ivar Johansson Stockholm, Sweden
|
|
|  |
 |

ivar
User
Dec 2, 2004, 2:18 AM
Post #11 of 18
(8330 views)
Shortcut
|
|
Re: [Mike4172] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Did anyone sort this out? It would be great to use that feature! Cheers Ivar Stockholm, Sweden
|
|
|  |
 |

ivar
User
Dec 2, 2004, 3:15 AM
Post #13 of 18
(8327 views)
Shortcut
|
|
Re: [Mike4172] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Nice one, Mike! Ivar
|
|
|  |
 |

ross
Staff
/ Moderator

Dec 2, 2004, 1:15 PM
Post #14 of 18
(8296 views)
Shortcut
|
|
Re: [Mike4172] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Hi Mike. Your site looks great so keep up the good work. Just let me know if there is anything I can help with . ----------------------------------------------------------- Cheers, Ross Fairbairn - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

Mike4172
User
Dec 3, 2004, 6:39 AM
Post #15 of 18
(8286 views)
Shortcut
|
|
Re: [ivar] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Ok, I went ahead and looked at the files and attached what you need to do here. 1) In your articles directory (default is /artman/publish directory) create a directory called counter (Note: if you use a different directoriy for each specific category, you must add all the steps listed here to each directory with the exception of creating a DB) 2) inside the /artman/publish/counter directory upload the files views.php and counter.php. At this point also create a mysql database and set things up accordingly with this two scripts. Use just ONE DB for both scripts. 3) create a page...say /mostpopulararticles.html ...and add <!--#include virtual="/artman/publish/counter/views.php?a=vs" --> (if your using .shtml pages for instance) This page should now display your most popular articles. 4) at anytime youc an access how many page hit each page has by going to http://www.yoursite.com/artman/publish/counter/counter.php?a=vs We've made modifications to the script since we posted this. The instructions above may or may not work with the most recent release of AM. Regards, Michael NEW!Logo and Website Design Auto Post Date and Expiration GoForum 2.02 http://www.amscripts.net SKYPE - michael.amscripts
(This post was edited by Mike4172 on Mar 12, 2005, 1:10 AM)
|
|
|  |
 |

MikeB
Staff
/ Moderator

Dec 3, 2004, 2:07 PM
Post #16 of 18
(8280 views)
Shortcut
|
|
Re: [Mike4172] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
Hey Mike, Thanks for the post! I'm sure that Ivar and anyone else who is looking to use this add-on will find your steps to be very valuable. Thanks! Keep us posted on how this works out and let me know if you have any other questions! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

alyates
User
Mar 11, 2005, 2:48 PM
Post #17 of 18
(7589 views)
Shortcut
|
|
Re: [Mike4172] addon: most read articles (requires php and mysql)
[In reply to]
|
Can't Post
|
|
I set everything up using your instructions but am receiving the following error on the mostpopular.shtml page. I created the database as instructed but do I actually need to create the tables as well. Query failed: error was Table 'counter.pagecounter' doesn't exist Thanks, Adam Yates
|
|
|  |
|