Posted in site documentation
4955
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
130
This Month
531
This Year
547

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
I'm a big believer in energy and the secret and that sort of thing.
Unknown
Random CSS Property

scroll-padding-block-end

The scroll-padding-block-end property defines offsets for the end edge in the block dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.
scroll-padding-block-end css reference