Kirby - At a Glance [widget]

Kirby - At a Glance

Version 1.0.0 - 2016-04-17

  • Initial Public Offering…

What is it?

Kirby - At a Glance is a simple widget for the Kirby CMS.

It shows a brief description of the main items in your site at the panel dashboard;

  1. Chapters
  2. Pages
  3. Images
  4. Files
  5. Users

More info about Kirby can be found at http://getkirby.com

##Installation##

  • Download the .zip and extract it to the root of your site.
  • The widget glance must be placed in \site\widgets\ and will show up on the dashboard of the panel.

Version 1.0.0

2 Likes

the glance folder is in the widgets folder but i cant see it

When there is no widgets folder, simply create it manually.

Or download the .zip-file which contains all folders and files.

Extract it to the root of your site and it will create this structure; <root>\site\widgets\glance


Btw. I stole it from WordPress :stuck_out_tongue:

Hihihihi it works :smiley: Thanks!

Great idea! But what is a chapter? Is that a page on the root level?

But what is a chapter? Is that a page on the root level?

Yeah - at least that’s what I call it (maybe it’s wrong?).

I always think of a site in these terms;

  1. Book
  2. Chapter
  3. Page
  4. Items

And those items stand for;

  1. Site
  2. Root-level page (mostly visible in the main menu)
  3. Sub-pages of every root-level page
  4. Page elements (DOM level)

I know this is not 100% correct, because a chapter is a page and can contains pages (which are chapters as well…).

But to keep an eye on the basic set-up I always think in these terms :slight_smile:

So a chapter contains at least one page (the page that powers the chapter) and can contain sub-pages.

When you have 9 chapters, you will always have 9 pages.

But when 2 chapters also have sub-pages, the total amount of pages is… 9 + 2 = 11

I hope this makes sense :slight_smile:


There was an error in the widget; the images were counted as chapters. I fixed it, but please do download the newest version.


Lol - I created my own (flat file based) CMS in the late '90’s, and I did use the same concept;

  1. Language
  2. Book
  3. Chapter
  4. Page
  5. Items

That way I could manage “complex” site with a lot of content easy; I always knew which page belonged to a certain chapter :stuck_out_tongue:

It looks like rubbish… all iFrames and inline scripting :frowning:

But it also worked with plain textfiles for the content and did have dynamic (sub-) modules.

You could also schedule posts and add comments to it, in case you were collaborating in an online team…

Please notice, this is more than 15 years old :stuck_out_tongue: and all written in .ASP

1 Like

You could get all your variables a lot easier without the foreach loop:

    $site = kirby()->site();
    $count_users = $site->users()->count();
    $count_chapters = $site->pages()->count();
    $count_subpages = $site->grandchildren()->count();
    $count_images = $site->index()->images()->count();
    $count_files = $site->index()->documents()->count();
    $count_pages = $site->index()->count();

And no need to define a global variable, either.

1 Like

Will try to update your - much better - code tomorrow, since it’s not working today :slight_smile:

- edit - Please notice I am a front-end developer; I don’t know anything about PHP / Kirby code, so sometimes it’s difficult to create a site for me.

Still doesn’t work, so I opened a new thread.

Update - All is fixed now :slight_smile:

Please, update to the latest version on GitHub - the code is now more efficient and the lay-out is slightly changed.

2 Likes

Nice idea! I just implemented this widget with my own needs. It’s kinda funny because I’m making a literary website that is actually categorized into books, chapters and single pages.

I am creating sites since 1993 - and all my sites have the analogy of;

  1. Language
  2. Book
  3. Chapter
  4. Page
  5. Items

It’s kind of abstract, but it really helps me get overview of a site / project :stuck_out_tongue:

what about a function how i can see How many People’s are watching my site at the Moment, do you have ideas for that?

You can implement that without problems - but it doesn’t fit in the scope I had for this widget;

The “index” of the site (pages, documents, etc…) is not the same as something like a stat-counter.

There are counters for Kirby, though - and of course you can always setup something like Google Analytics and / or Piwik.

Maybe try some of these?