Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Embed on frontpage
02-05-2010, 12:12 PM
Post: #1
Embed on frontpage
Hi Smile

I was wondering, would it be possible to display the counter/s on the frontpage of my site,
and not only if I go to mysite.com/grape/ Huh

I don't want all the boxes, but the "Visits" box would be great.

I'm no php guru, so please be gentle Tongue
Visit this user's website Find all posts by this user
Quote this message in a reply
02-06-2010, 12:28 PM (This post was last modified: 02-06-2010 12:28 PM by slythfox.)
Post: #2
RE: Embed on frontpage
Grape isn't well modularized at the moment, especially "Visits" since it was not set up as extension. So you'll need to do some hand editing.
First, you'll need to add:
Code:
$location = "./";
require_once($location. "includes/functions.php");

// Connect to the database.
dbconnect();
This will give all the necessary functions needed to get the visits information.

Next, you'll need to copy lines 238 (where the comment says "// MODULE: Display basic visit statistics") through 424 from /index.php in the latest release (0.2.0.4). This code queries the data and displays it as appropriately. Feel free to edit the HTML code as you please; experiment until you get it how you want.

This code depends on some variables that hold the current date. You can mess around with these variables, but by default they are set to the current time. Copy this code (found in lines 82 through 93) and put it before the big chunk of code I had you copy above:
Code:
// Set initial dates.
$minute = date("i");
$minute_selected = $minute;
$hour = date("G");
$hour_selected = $hour;
$day = date("j");
$day_selected = $day;
$month = date("n");
$month_selected = $month;
$year = date("y");
$year_selected = $year;
$display = "month";
Find all posts by this user
Quote this message in a reply
02-06-2010, 01:43 PM
Post: #3
RE: Embed on frontpage
Thanx! Smile

I actualy made it work by creating a new "theme" that only had the parts I wanted,
and then added a "hidden" class to the bar with all the dropdowns.

Works like a charm! Big Grin

I then copied the styles over to my main css file and styled it to fit with my sites theme.

I realy like this script, thank you very much for releasing this as open source Smile
I'l add a link to your site!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply