Posted in site documentation
12:52 am, September 2, 2021

moving the hits widget into the post header and footer

I wanted to make a smaller deal of the views page widget, i was adding it as a full widget and it does not need to be that huge so moving from widget area to the top of the post. 

Move it down into this area

I think when you first add a feature to a site, you want it to be very visible, but maybe a more subtle approach is better for things like this, as it does not really matter to the viewer how many times the page has been viewed. 


// old code adding to widget
if(isset($hits->hits)) {
	$hits_card = new template("card-title.html");
	$hits_card->set("title", "Page Views");
	$hits_card->set("content", "<p>This page has been viewed <b>$hits->hits</b> times.</p>");

// new code adding to page template
$template->set("hits", "");
if(isset($hits->hits)) {
	$template->set("hits", $hits->hits);

View Statistics
This Week
This Month
This Year

No Items Found.

Add Comment
Type in a Nick Name here
Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

Join me on Substack if you want me to send you a collection of the things i have done or found or read for the week. Or follow me on twitter if you prefer, i dont post much but i probably should!


Random Quote
"Let us prepare our minds as if we'd come to the very end of life. Let us postpone nothing. Let us balance life's books each day ... The one who puts the finishing touches on their life each day is never short of time."