Posted in site documentation
4980
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
101
This Month
369
This Year
572

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
For a long time it had seemed to me that life was about to begin - real life. But there was always some obstacle in the way, something to be gotten through first, some unfinished business, time still to be served, or a debt to be paid. Then life would begin. At last it dawned on me that these obstacles were my life.
Alfred D. Souza
Random CSS Property

initial-letter-align

Experimental: This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
initial-letter-align css reference