Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

My Vanilla Theme

SevMCSevMC
edited May 2012 in Vanilla 2.0 - 2.8

At last, I finished my first theme for vanilla :D

I love how eassy is to theme vanilla :)

Check it out: www.makeitsound.org

Comments

  • ChanuxChanux ✭✭
    edited May 2012

    wow... nice one. like that.

    every discussion display 2 users pictures. discussion start user pic and latest user pic. how can i do it. can you explain

  • Sure, you just need to modify the helper_functions.php file, you can find it at applications/vanilla/views/discussions (Copy it to your theme).

    Search for:

        <?php
                    if ($Session->IsValid() && $Discussion->CountUnreadComments > 0)
                       echo '<strong>'.Plural($Discussion->CountUnreadComments, '%s New', '%s New Plural').'</strong>';
    
                    $Sender->FireEvent('AfterCountMeta');
    
                    if ($Discussion->LastCommentID != '') {
                       echo '<span class="LastCommentBy">'.sprintf(T('Most recent by %1$s'), UserAnchor($Last)).'</span>';
                       echo '<span class="LastCommentDate">'.Gdn_Format::Date($Discussion->LastDate).'</span>';
                    } else {
                       echo '<span class="LastCommentBy">'.sprintf(T('Started by %1$s'), UserAnchor($First)).'</span>';
                       echo '<span class="LastCommentDate">'.Gdn_Format::Date($Discussion->FirstDate);
    
                       if ($Source = GetValue('Source', $Discussion)) {
                          echo ' '.sprintf(T('via %s'), T($Source.' Source', $Source));
                       }
    
                       echo '</span>';
                    }
    
                    if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '')
                       echo Wrap(Anchor($Discussion->Category, '/categories/'.rawurlencode($Discussion->CategoryUrlCode), 'Category'));
    
                    $Sender->FireEvent('DiscussionMeta');
                 ?>
    

    And replace with:

    <?php if ($Session->IsValid() && $Discussion->CountUnreadComments > 0) echo ''.Plural($Discussion->CountUnreadComments, '%s New', '%s New Plural').''; $Sender->FireEvent('AfterCountMeta'); if ($Discussion->LastCommentID != '') { echo ' '.UserPhoto($Last).''.''; echo ''.Gdn_Format::Date($Discussion->LastDate).''; echo ''.UserPhoto($First).''.''; } else { echo ' '.UserPhoto($First).''.''; echo ''.Gdn_Format::Date($Discussion->FirstDate); if ($Source = GetValue('Source', $Discussion)) { echo ' '.sprintf(T('via %s'), T($Source.' Source', $Source)); } echo ''; } if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '') echo Wrap(Anchor($Discussion->Category, '/categories/'.rawurlencode($Discussion->CategoryUrlCode), 'Category')); $Sender->FireEvent('DiscussionMeta'); ?>

    **Then, try to make them suit with your template using css:

    I used this:**

    .Discussion.ItemContent { margin-left: 70px; position:relative; padding-left:65px; width: 390px; } .reply-avatar { position:absolute;left:0px;top:0px; } .author-avatar { position:absolute;left:-77px;top:0px; } .reply-arrow { position:absolute; top:15px; left:-19px; background-image: url("images/REPLY-ARROW.png") ; width:20px; height:26px; } .author-arrow { position:absolute; top:15px; left:-19px; background-image: url("images/AUTHOR-ARROW.png"); width:72px; height:26px; } ul.Discussions li img { float: left; height: 35px; margin: 6px 0px 4px 10px; width: 35px; }

    I got the idea seeing the Vanilla Skins themes (http://vanillaskins.com/themes/), they are awesome.

  • :) thought i recognised the classes thankyou.

    There was an error rendering this rich post.

  • SevMCSevMC
    edited May 2012

    422 said:
    :) thought i recognised the classes thankyou.

    Well, it was your idea, so thank you :)

    I had an error, I don't know why I deleted the last comment by and last comment date tags.

    Here is the fixed code:

    <?php
                if ($Session->IsValid() && $Discussion->CountUnreadComments > 0)
                   echo '<strong>'.Plural($Discussion->CountUnreadComments, '%s New', '%s New Plural').'</strong>';
    
                $Sender->FireEvent('AfterCountMeta');
    
                if ($Discussion->LastCommentID != '') {
                   echo '<span class="LastCommentBy"><div class="reply-arrow">&nbsp;</div><span class="reply-avatar">'.UserPhoto($Last).'</span>'.'</span>';
                   echo '<span class="LastCommentDate">'.Gdn_Format::Date($Discussion->LastDate).'</span>';
                    echo '<span><span class="author-avatar">'.UserPhoto($First).'</span>'.'</span>';
                } else {
                   echo '<span class="LastCommentBy"><div class="author-arrow">&nbsp;</div><span class="author-avatar">'.UserPhoto($First).'</span>'.'</span>';
                   echo '<span class="LastCommentDate">'.Gdn_Format::Date($Discussion->FirstDate);
    
                   if ($Source = GetValue('Source', $Discussion)) {
                      echo ' '.sprintf(T('via %s'), T($Source.' Source', $Source));
                   }
    
                   echo '</span>';
                }
    
                if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '')
                   echo Wrap(Anchor($Discussion->Category, '/categories/'.rawurlencode($Discussion->CategoryUrlCode), 'Category'));
    
                $Sender->FireEvent('DiscussionMeta');
             ?>
    
  • incidentally, your theme is stunning. Great work

    There was an error rendering this rich post.

  • Thanks :D

Sign In or Register to comment.