This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

This will show you how to create a citation block with just a few lines of code. You can see it in action in the footer. Today I'll show you how to create a citation block for MLA 7. This block will cite pages automatically with you providing a little bit of detail once. None of this is anything new, I'm just combining various snippets to create it.

<?php echo $c->getVersionObject()->getVersionAuthorUserName(); ?>

This code loads the user name of the person who posted it. I'm going to equate this to author at http://www.scribd.com/doc/20855461/MLA7-Web-Sources Next, we need to do the title. Often the title is the name of the page, so i'm going to use this.

<?php echo $c->getCollectionName() ?>

Next we need to do the website name. I'll use the code to get the site name in themes here.

<a href="<?php echo DIR_REL?>/"><?php     echo SITE?></a>

This is supposed to be in italics though, so ill wrap it up like this.

<i><a href="<?php     echo DIR_REL?>/"><?php     echo SITE?></a>. </i>

The edition is next, which is fairly similar to c5s version control, so i'll call the version number.

<?php echo $c->getVersionID()?>

Next we need the publisher. Since c5 doesn't use meta author, I didn't think there was anything equatable to load, just fill this in with yourpublisher once. You can then load it anytime, so it doesn't require maintenance. If you think there is something equatable just tell me and i'll update it.

Publisher,

Next we need to load the publication date. Weblicating has date last edited snippet on their cheatsheet so i'll use that. Note that this calls the area main for date last edited, not sidebar.

<?php
$date = Loader::helper("date");
foreach($c->getBlocks('Main') as $b) {
    $bDate[$i] = $b->getBlockDateLastModified();
    $i ++;
}

rsort( $bDate );

echo $date->getLocalDateTime($bDate[0],$mask = 'J F. Y');
?>

Next its a static

Web.

and finally the current date, loaded through this

<?php echo date('j F. Y'); ?>

So all in all we have

<?php  echo $c->getVersionObject()->getVersionAuthorUserName(); ?>. "<?php echo $c->getCollectionName() ?>."
    <i><a href="<?php     echo DIR_REL?>/"><?php     echo SITE?></a>. </i>
    <?php echo $c->getVersionID()?>.
 12345j, 
<?php
$date = Loader::helper("date");

foreach($c->getBlocks('Main') as $b) {
    $bDate[$i] = $b->getBlockDateLastModified();
$i ++;
}

rsort( $bDate );
echo $date->getLocalDateTime($bDate[0],$mask = 'j F. Y'); ?>. Web.  <?php     echo date('j F. Y')?>.
Loading Conversation