how do I put a last modified date on pages?

General chit chat about razor, not specifically related to a topic but about razorCMS

how do I put a last modified date on pages?

Postby lexsite » Fri Aug 30, 2013 10:19 pm

I would like to add a last modified date to my pages that shows when the article content was either created or updated.
Is that possible? If so, how do I do it?

Thanks
Lexsite
Mobile Friendly Website Design
http://lexsite.org
lexsite
 
Posts: 3
Joined: Fri Jan 18, 2013 9:19 pm
Location: Oklahoma City

Re: how do I put a last modified date on pages?

Postby Adminer » Sat Aug 31, 2013 12:39 pm

Hi!
Many years ago was here an old version of blade pack to do this: last_edit

viewtopic.php?f=9&t=320&p=1806&hilit=lastedit#p1806

It's very old file and will not work with our new version 1.22 Phoenix - so you should rewrite it in PHP to new razorCMS blade pack standard - it's shoud be easy to do.

In my razorCMS skin theme, I have something very simple ;-) like this with a php code inside html:
Last edited:<?php print " " . date("d-m-Y", getlastmod());?>

Code: Select all
<!-- block-content-->
            <div class="elite-layout-cell elite-content">            
               <div class="elite-post">
                  <div class="elite-post-body">
                     <div class="elite-post-inner elite-article">
                             <div class="elite-postmetadataheader">
                                        <h2 class="elite-postheader">

                   &raquo; <?php loadPageTitle(); ?> </h2>

                    <div class="cleared"></div>
                                    </div>
            <div class="elite-postheadericons elite-metadata-icons">
                    <img src="blade_packs/theme_yourtheme/images/postdateicon.png" width="17" height="18" alt="" />
<?php
function datownik()
{
$data = date('w'); // day in number
$rok = date('Y'); // year
$godzina = date('H:i'); // clock
$dzien = date('d'); // day
$miech = date('n'); // month
$dzien_tygodnia = array(
0 => 'niedzielę',
1 => 'poniedziałek',
2 => 'wtorek',
3 => 'środę',
4 => 'czwartek',
5 => 'piątek',
6 => 'sobotę'
);
$miesiac = array(
1 => 'stycznia',
2 => 'lutego',
3 => 'marca',
4 => 'kwietnia',
5 => 'maja',
6 => 'czerwca',
7 => 'lipca',
8 => 'sierpnia',
9 => 'września',
10 => 'października',
11 => 'listopada',
12 => 'grudnia'
);
return ' :: Today we have in polish language '.$dzien_tygodnia[$data].' '.$dzien.' '.$miesiac[$miech].' '.$rok.'r.';
}
?>
                     | <img src="blade_packs/theme_yourtheme/images/postauthoricon.png" width="14" height="14" alt="" />

                    Last edited:<?php print " " . date("d-m-Y", getlastmod());?>

               <a href="#" title="Author">Adminer </a><?php echo datownik();?>
            </div>
                        <div class="elite-postcontent">
                                       
                        
                           <!-- article-content -->                                                 
                              <?php loadSlabContents(); ?>
                              <?php BsocketB('public-xhtml-content'); ?>                                       
                           <!-- /article-content -->
                        </div>
                        
                        <div class="cleared"></div>
                     </div>
                     <div class="cleared"></div>
                  </div>
               </div>
               <div class="cleared"></div>
            </div>      
<!-- /block-content-->




Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: how do I put a last modified date on pages?

Postby -Luigi- » Fri Sep 13, 2013 12:30 pm

Hi, I'm triying to include the published date on pages (I guess it would be the same as last modified) but this isn't working for me. It shows a static date (Jan-13-2013) instead the last modification date.

Is this supossed to be used with a plugin or am I doing something wrong? By the way, this is for normal pages not for news entries.

Thanks
-Luigi-
 
Posts: 9
Joined: Thu Sep 12, 2013 7:20 pm

Re: how do I put a last modified date on pages?

Postby Adminer » Fri Sep 13, 2013 7:59 pm

-Luigi- wrote:Hi, I'm triying to include the published date on pages (I guess it would be the same as last modified) but this isn't working for me. It shows a static date (Jan-13-2013) instead the last modification date.
Is this supossed to be used with a plugin or am I doing something wrong? By the way, this is for normal pages not for news entries.
Thanks


This php code: <?php print " " . date("d-m-Y", getlastmod());?> should be inside in your razorCMS php theme - not on your page putted inside by admin in razor text editor.
It's a date of creation article txt file. If you "touch" your article today or restore from backup - the date will be from today.
Blade pack is possible - with another flat database with an information about date of last edited article.

Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: how do I put a last modified date on pages?

Postby -Luigi- » Sat Sep 14, 2013 12:10 am

Adminer wrote:
-Luigi- wrote:Hi, I'm triying to include the published date on pages (I guess it would be the same as last modified) but this isn't working for me. It shows a static date (Jan-13-2013) instead the last modification date.
Is this supossed to be used with a plugin or am I doing something wrong? By the way, this is for normal pages not for news entries.
Thanks


This php code: <?php print " " . date("d-m-Y", getlastmod());?> should be inside in your razorCMS php theme - not on your page putted inside by admin in razor text editor.
It's a date of creation article txt file. If you "touch" your article today or restore from backup - the date will be from today.
Blade pack is possible - with another flat database with an information about date of last edited article.

Regards


Thanks for your reply. I do have it inside my theme but the date does not change when I modify a page. I even tried copying the whole code to see if that works but it doesn't. Always shows the same date (Jan-13-2013) and I don't know why.
-Luigi-
 
Posts: 9
Joined: Thu Sep 12, 2013 7:20 pm

Re: how do I put a last modified date on pages?

Postby -Luigi- » Sat Sep 14, 2013 12:14 am

I just created another page to compare and got the same date again (Jan-13-2013)
-Luigi-
 
Posts: 9
Joined: Thu Sep 12, 2013 7:20 pm

Re: how do I put a last modified date on pages?

Postby Adminer » Sat Sep 14, 2013 9:51 am

-Luigi- wrote:I just created another page to compare and got the same date again (Jan-13-2013)


it's not possible to receive Jan-13-2013, because if this works: <?php print " " . date("d-m-Y", getlastmod());?>
you have d-m-y format for the date: day-month-year, if this works.
So, this blade don't work in your default razor theme between two div inside content page.
Show me your theme file and where you put this blade in this main theme code.

Did you put this here:
<?php print " " . date("d-m-Y", getlastmod());?>
<div>
<!-- article-content -->
<?php loadSlabContents(); ?>
<?php BsocketB('public-xhtml-content'); ?>
<!-- /article-content -->
</div>

Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: how do I put a last modified date on pages?

Postby -Luigi- » Sat Sep 14, 2013 9:52 pm

it's not possible to receive Jan-13-2013, because if this works: <?php print " " . date("d-m-Y", getlastmod());?>
you have d-m-y format for the date: day-month-year, if this works.


You're right, the real info is 13-01-2013, it's just that I use to put the date in mmm-dd-yyyy format. So I was reading the first and writting the second. My appologies for that.

This is my theme code where I put the blade:
Code: Select all
<div class="entry">
   <?php loadSlabContents(); ?>
   <?php BsocketB('public-xhtml-content'); ?>
   <div class="meta">
   <p><span class="listed">Updated on <?php print " " . date("d-m-Y", getlastmod());?></p>
   </div>
</div>


Thanks
-Luigi-
 
Posts: 9
Joined: Thu Sep 12, 2013 7:20 pm

Re: how do I put a last modified date on pages?

Postby Adminer » Mon Sep 16, 2013 12:14 pm

Hi!

Simple solution - LastEdit blade pack:
viewtopic.php?f=9&t=1364

Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: how do I put a last modified date on pages?

Postby -Luigi- » Wed Sep 18, 2013 4:25 am

Thanks
-Luigi-
 
Posts: 9
Joined: Thu Sep 12, 2013 7:20 pm


Return to General Discussions



Who is online

Users browsing this forum: No registered users and 1 guest

cron