It is currently 19 Feb 2018, 17:46

GIMP/GL InterestsTopics/Posts by month graphs custom pages for phpbb 3.2 (Showcase | Slideshow)

GIMP or GIMP LEARN Forum Interests
Post Reply
User avatar
tim

Administrator
View: Showcase | Slideshow
Topic Posts: 2/2
Posts: 2157
Joined: 26 Sep 2016, 00:16
Cash on hand: 7,894.01 GLP
Bank: 51,356.25 GLP
Gender: Guy
Location: Victoria, BC
Website: https://gimplearn.net
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1196
x 256
Contact:
Canada

Topics/Posts by month graphs custom pages for phpbb 3.2

Post#1 by tim » 21 Feb 2017, 23:58


Graphing topics/posts by month for phpbb 3.2 (in our case, GIMP LEARN forum).
graph topics by month
graph posts by month

I used the below php code and google chart/graphs api

for graph topics by month

Code: Select all

<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year-Mo', 'Topics']
<?php

//connect to your database
mysql_connect('localhost','bakon306_phpb537','password'); //(host, username, password)

//specify database
mysql_select_db('bakon306_phpb537') or die("Unable to select database"); //select which database we're using

$query = "
SELECT DATE_FORMAT(from_unixtime(topic_time),'%Y-%m') as dt,
       count(*) as count
FROM `phpbbsf_topics`
GROUP BY dt
ORDER BY dt";
 $numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
// next determine if s has been passed to script, if not use 0
// get results
  #$query .= " limit 30";
  $result = mysql_query($query) or die("Couldn't execute query");




// now you can display the results returned
	while ($row=mysql_fetch_array($result)) {
	  //$filename = $row["physical_filename"];
		$dt = $row["dt"];
		$count = $row["count"];
		print ",['".$dt."',".$count."]";
		#['2005',  1170,      460],
	}
?>
]);

        var options = {
          title: 'Topics added by month',
          //curveType: 'function',
          legend: { position: 'bottom' }
        };

        var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));

        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
	Topics added by month graph on <a href="http://gimplearn.net/">GIMP LEARN forum</a><br/>
	<a href="http://gimplearn.net/styles/prosilver/template/graph_topics.php">graph topics by month</a><br/>
	<a href="http://gimplearn.net/styles/prosilver/template/graph_posts.php">graph posts by month</a><br/>
    <div id="curve_chart" style="width: 900px; height: 500px"></div>
  </body>
</html>
for graph posts by month

Code: Select all

<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year-Mo', 'Posts']
<?php

//connect to your database
mysql_connect('localhost','bakon306_phpb537','password'); //(host, username, password)

//specify database
mysql_select_db('bakon306_phpb537') or die("Unable to select database"); //select which database we're using

$query = "
SELECT DATE_FORMAT(from_unixtime(post_time),'%Y-%m') as dt,
       count(*) as count
FROM `phpbbsf_posts`
GROUP BY dt
ORDER BY dt";
 $numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
// next determine if s has been passed to script, if not use 0
// get results
  #$query .= " limit 30";
  $result = mysql_query($query) or die("Couldn't execute query");




// now you can display the results returned
	while ($row=mysql_fetch_array($result)) {
	  //$filename = $row["physical_filename"];
		$dt = $row["dt"];
		$count = $row["count"];
		print ",['".$dt."',".$count."]";
		#['2005',  1170,      460],
	}
?>
]);

        var options = {
          title: 'Posts added by month',
          //curveType: 'function',
          legend: { position: 'bottom' }
        };

        var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));

        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
	Posts added by month graph on <a href="http://gimplearn.net/">GIMP LEARN forum</a><br/>
	<a href="http://gimplearn.net/styles/prosilver/template/graph_topics.php">graph topics by month</a><br/>
	<a href="http://gimplearn.net/styles/prosilver/template/graph_posts.php">graph posts by month</a><br/>
    <div id="curve_chart" style="width: 900px; height: 500px"></div>
  </body>
</html>
The two pages are nearly identical except for description and of graph and query.
You'll have change database, username and password for your own phpbb forum if you want to use it.
0 x



aka Tin
Image gimplearn.net                                              

Registered members enjoy ads-free content
User avatar
tim

Administrator
View: Showcase | Slideshow
Topic Posts: 2/2
Posts: 2157
Joined: 26 Sep 2016, 00:16
Cash on hand: 7,894.01 GLP
Bank: 51,356.25 GLP
Gender: Guy
Location: Victoria, BC
Website: https://gimplearn.net
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1196
x 256
Contact:
Canada

Post#2 by tim » 25 Jul 2017, 18:57


Added link on bottom of pages called TPSA (Topics/Posts/Sessions/Attachments) Graphs
Where you can view 4 different graphs
tpsa_graphs.php?graph=Topics
tpsa_graphs.php?graph=Posts
tpsa_graphs.php?graph=Sessions
tpsa_graphs.php?graph=Attachments
0 x



aka Tin
Image gimplearn.net                                              

Post Reply

Last 20 Members Who Visited This Topic

User avatar tim (16), User avatar Steve Reid (1)

  • Similar Topics
    Replies
    Views
    Last post
• Featuring Members' Works (Image Attachments Only) •
1: Ella
2: gnerd
3: Pat625
4: Pat625
5: Issabella
6: Meemaw
7: oldmangrumpy

Who is online

Users browsing this forum: No registered users and 1 guest