Posted in site documentation
4956
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
131
This Month
532
This Year
548

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


minecraft
Random CSS Property

@charset

The @charset CSS at-rule specifies the character encoding used in the style sheet. It must be the first element in the style sheet and not be preceded by any character; as it is not a nested statement, it cannot be used inside conditional group at-rules. If several @charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an HTML element or inside the <style> element where the character set of the HTML page is relevant.
@charset css reference