1 (edited by tovic 2014-02-21 08:34:42)

Topic: Page Views Counter

Download Here

Installation

Download and extract the plugin, put the pageview folder with its contents in plugins folder. Update your config.php file:

<?php
    return array(
        ...
        ...
        ...
        'plugins' => array(
            'markdown',
            'sitemap',
            'admin', // <= Recommended to be installed
            'pageview' // <= Activation
        ),
        'pageview_config' => array(
            // Change to `false` if you want to remove the leading zero in counter
            'leading_zero' => '0000'
        )
    );

Updating the Template File

In your blog_post.html template, add this code wherever you like. Do it once, or you will get double page views in one page:

<span class="page-views">
    <strong class="page-views-label">Total Page Views:</strong> 
    <span class="page-views-counter">
        <?php Morfy::factory()->runAction('pageview'); ?>
    </span>
</span>

Done.

Disabling the Page Views Counter for Admin

The admin plugin is not required. But if you already have it installed in your theme, then your page visits will not be included in the page views if you already logged in.

XSS Testing <script>alert('HIYAA!!!');</script>

Re: Page Views Counter

Good Job! )

Monstra Loves You! Give some love back!

Re: Page Views Counter

Nice wink

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

4 (edited by tovic 2014-02-18 02:51:27)

Re: Page Views Counter

@nakome Did you already have plans to create a dashboard/editor plugin? If not maybe I’ll make it. But probably it will took quite a long time, and I need help. I like your idea about showing the dashboard directly in the posting page. It makes me easy to determine where the post will be saved because I can get the correct folder path from the current URL. I have the basic concept that will make this dashboard panel become flexible:

// Include the dashboard menu
Morfy::factory()->addAction('theme_content_after', function() {

    echo '<nav class="dashboard-panel" id="dashboard-panel">';
    echo '<ul>';
    Morfy::factory()->runAction('dashboard_menu');
    echo '</ul>';
    echo '</nav>';

});

// Include the menu item
Morfy::factory()->addAction('dashboard_menu', function() {
    echo '<li><a href="#add">New Post</a></li>';
});

That dashboard_menu hook will allows another plugins to insert new menu just by adding some new list element. From another plugin folder:

// Include some menu item
Morfy::factory()->addAction('dashboard_menu', function() {
    echo '<li><a href="#test-1">Test 1</a></li>';
    echo '<li><a href="#test-2">Test 2</a></li>';
    echo '<li><a href="#test-3">Test 3</a></li>';
});

Or if you already have that plan maybe you can consider using my dashboard pattern. Thx.

XSS Testing <script>alert('HIYAA!!!');</script>

Re: Page Views Counter

Edit:

Ack! More difficult than I expected. I found out after trying to add CSS. The result become like this:

<li><a href="#add">New Post</a></li>
<nav class="dashboard-panel" id="dashboard-panel"><ul></ul></nav>

The menu item came first before the panel, instead of going into it sad

XSS Testing <script>alert('HIYAA!!!');</script>

Re: Page Views Counter

I Think is more good make views folder in folder of admin and redirect here, and if not login redirect to login  you understand.
See this mockup Admin panel mockup

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

Re: Page Views Counter

nakome wrote:

I Think is more good make views folder in folder of admin and redirect here, and if not login redirect to login you understand.
See this mockup Admin panel mockup

My bad. I can’t download it at this time... But if I can understand, you mean like on this page, right?

Actually, what I think is something more simple like this:

http://i62.tinypic.com/e5pl4w.png
URL: http://localhost/notes/morfy-cms/plugins/page-slug

Actions:
1. New Post → Create a new post in morfy-cms/plugins folder.
2. Edit Post → Edit page-slug.md file.
3. Create Sub-Page → Create a new folder in morfy-cms/plugins and a new index.md file for that folder.

XSS Testing <script>alert('HIYAA!!!');</script>

Re: Page Views Counter

http://s29.postimg.org/cglm7ixd3/8t_Bkqbq.png
very nice admin panel
it would nice if it was with bootstrap 3 smile

Re: Page Views Counter

Thank's  dextra  is part of my other project,

I don't use bootstrap or foundation because i don't need,

I thought to use Biru Framework but  too much css  for this.

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

Re: Page Views Counter

There’s a Bootstrap CDN that’s has cacheable resources.

XSS Testing <script>alert('HIYAA!!!');</script>

Re: Page Views Counter

I make mockup with bootstrap here only rest icons and codemirror (obviously also  php wink)

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

Re: Page Views Counter

Neat! http://jsbin.com/nivaqubu/1

XSS Testing <script>alert('HIYAA!!!');</script>

Re: Page Views Counter

Nice

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

Re: Page Views Counter

tovic wrote:

@nakome Did you already have plans to create a dashboard/editor plugin? If not maybe I’ll make it. But probably it will took quite a long time, and I need help. I like your idea about showing the dashboard directly in the posting page. It makes me easy to determine where the post will be saved because I can get the correct folder path from the current URL. I have the basic concept that will make this dashboard panel become flexible:

// Include the dashboard menu
Morfy::factory()->addAction('theme_content_after', function() {

    echo '<nav class="dashboard-panel" id="dashboard-panel">';
    echo '<ul>';
    Morfy::factory()->runAction('dashboard_menu');
    echo '</ul>';
    echo '</nav>';

});

// Include the menu item
Morfy::factory()->addAction('dashboard_menu', function() {
    echo '<li><a href="#add">New Post</a></li>';
});

That dashboard_menu hook will allows another plugins to insert new menu just by adding some new list element. From another plugin folder:

// Include some menu item
Morfy::factory()->addAction('dashboard_menu', function() {
    echo '<li><a href="#test-1">Test 1</a></li>';
    echo '<li><a href="#test-2">Test 2</a></li>';
    echo '<li><a href="#test-3">Test 3</a></li>';
});

Or if you already have that plan maybe you can consider using my dashboard pattern. Thx.

hi tovic
create a dashboard/editor plugin?

Re: Page Views Counter

Oh, it was… I had planned it, and the draft code, but the result may not be appropriate as expected. Creating a form submission for posting new article or editing an article is easy as writing a simple fwrite() function in PHP, but making it future proof is a bit difficult. Not for now.

I’m in focusing on my new toy (text editor framework), maybe if everything already stable, I will make that plugin big_smile

XSS Testing <script>alert('HIYAA!!!');</script>