Posted in site documentation
4913
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. 

PHP

// 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>");
	$widgets->add($hits_card->output());
}

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

View Statistics
This Week
52
This Month
489
This Year
505

No Items Found.

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

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
therock Somewhere along this crazy road I learned (often times the hard way) the most important things I can do is be authentic, trust my gut, be the hardest worker in the room, celebrate the mistakes, be a grateful man and always remember that it's nice to be important, but it's more important to be nice.
The Rock
Random CSS Property

<length>

The <length> CSS data type represents a distance value. Lengths can be used in numerous CSS properties, such as width, height, margin, padding, border-width, font-size, and text-shadow.
length#pc css reference