Advertisement:

Author Topic: [Tip&trick] Vb postbit  (Read 100423 times)

babjusi

  • Guest
[Tip&trick] Vb postbit
« on: July 31, 2008, 04:24:42 PM »
Recently I made this for someone here who asked me. It displays the post info at the topic view in a bordered way, vb style. Which I think it's a more organized look and will be effective in every post on your forum. That guy had seen it at another forum, not smf, and asked me to port it over to his smf forum as well. So, I did that and I thought to share it here as well.


Here we go.

First of all make a backup of the files before you apply the changes

Add the following set of code all the way to the bottom of the style.css file in your theme''s directory

Code: [Select]
.memdetails {
    padding-top: 3px;
    padding-right: 0px;
    padding-bottom: 3px;
    padding-left: 3px;
    margin: 3px 0px 3px 3px;
    background-color: #fafcfe;
    border-top: 1px solid #686868 ;
    border-right: 1px solid #686868 ;
    border-left: 3px solid #686868 ;
    border-bottom: 1px solid #686868;
}       

Save the changes and re-upload the file back overwriting the old one.

Next, upload the Display.template.php file from your /Themes/ directory  to your pc and open it with a decent php editor program and find the following code:

Code: [Select]
// Show the member's custom title, if they have one.
      if (isset($message['member']['title']) && $message['member']['title'] != '')
         echo '
                        ', $message['member']['title'], '<br />';


Change it to:

Code: [Select]
// Show the member's custom title, if they have one.
      if (isset($message['member']['title']) && $message['member']['title'] != '')
         echo '
                        <div class="memdetails">', $message['member']['title'], '</div>';


Find:

Code: [Select]
// Show the member's primary group (like 'Administrator') if they have one.
      if (isset($message['member']['group']) && $message['member']['group'] != '')
         echo '
                        ', $message['member']['group'], '<br />';


Change it to:

Code: [Select]
// Show the member's primary group (like 'Administrator') if they have one.
      if (isset($message['member']['group']) && $message['member']['group'] != '')
         echo '
                        <div class="memdetails">', $message['member']['group'], '</div>';


Find:

Code: [Select]
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
         if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
            echo '
                        ', $message['member']['post_group'], '<br />';
         echo '
                        ', $message['member']['group_stars'], '<br />';


Change it to:

Code: [Select]
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
         if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
            echo '
                        <div class="memdetails">', $message['member']['post_group'], '</div>';
         echo '
                        <div class="memdetails">', $message['member']['group_stars'], '</div>';



Find:

Code: [Select]
// Is karma display enabled?  Total or +/-?
         if ($modSettings['karmaMode'] == '1')
            echo '
                        <br />
                        ', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '<br />';
         elseif ($modSettings['karmaMode'] == '2')
            echo '
                        <br />
                        ', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '<br />';

Change it to:

Code: [Select]
// Is karma display enabled?  Total or +/-?
         if ($modSettings['karmaMode'] == '1')
            echo '
                       
                        <div class="memdetails">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</div>';
         elseif ($modSettings['karmaMode'] == '2')
            echo '
                        <div class="memdetails">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</div>';


Find:

Code: [Select]
// Show online and offline buttons?
         if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
            echo '
                        ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $message['member']['online']['image_href'] . '" alt="' . $message['member']['online']['text'] . '" border="0" style="margin-top: 2px;" />' : $message['member']['online']['text'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $message['member']['online']['text'] . '</span>' : '', '<br /><br />';

Change it to:

Code: [Select]
// Show online and offline buttons?
         if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
            echo '
                        <div class="memdetails">', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $message['member']['online']['image_href'] . '" alt="' . $message['member']['online']['text'] . '" border="0" style="margin-top: 2px;" />' : $message['member']['online']['text'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $message['member']['online']['text'] . '</span>' : '', '<br /></div>';


Find:

Code: [Select]
// Show how many posts they have made.
         echo '
                        ', $txt[26], ': ', $message['member']['posts'], '<br />
                        <br />';


Change it to:

Code: [Select]
// Show how many posts they have made.
         echo '
                        <div class="memdetails">', $txt[26], ': ', $message['member']['posts'], '</div>';


Find:

Code: [Select]
// Show their personal text?
         if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
            echo '
                        ', $message['member']['blurb'], '<br />
                        <br />';

Change it to:

Code: [Select]
// Show their personal text?
         if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
            echo '
                        <div class="memdetails">', $message['member']['blurb'], '</div>
                        <br />';


That was it. Save the changes and re-upload the file back overwriting the old one. Personally I do think that this looks very nice on topic view. But you can judge by yourself based on the screenshot attached.

Here is like it looks in action. This is for the 1.1. series


The mod version can be found here
 
 http://custom.simplemachines.org/mods/index.php?mod=1371
 
« Last Edit: September 03, 2008, 08:10:41 AM by babjusi »

Offline Hoochie Coochie Man

  • SMF Hero
  • ******
  • Posts: 5,135
  • Gender: Male
    • İstanblues.org
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #1 on: August 02, 2008, 03:54:32 PM »
Very nice, thanks..
İnadına SMF 1.1.X

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #2 on: August 04, 2008, 09:30:05 AM »
Indexed.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Offline ormuz

  • Full Member
  • ***
  • Posts: 677
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #3 on: August 25, 2008, 02:38:45 PM »
How to add this trick to custom profile mod?

babjusi

  • Guest
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #4 on: August 25, 2008, 02:43:41 PM »
How to add this trick to custom profile mod?

I am not sure that I understood you. What is is exactly that you mean or want to accomplish by doing that? Because this has nothing to do with the custom profile mod.

Offline ormuz

  • Full Member
  • ***
  • Posts: 677
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #5 on: August 25, 2008, 02:58:54 PM »
How to add this trick to custom profile mod?

I am not sure that I understood you. What is is exactly that you mean or want to accomplish by doing that? Because this has nothing to do with the custom profile mod.

Costum profile mod add the ability to add costum fields to the postbit on the display.template.php

I just want to add this trick (the memdetails div) to the field that I have in my postbit

this is the code from the mod in the display template, how to add this trick to the mod?
Code: [Select]
              global $sourcedir, $messagevars;
$messagevars = $message;
require_once($sourcedir . '/CustomProfile.php');
DisplayFieldPosts();

babjusi

  • Guest
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #6 on: August 26, 2008, 05:57:07 AM »
How to add this trick to custom profile mod?

I am not sure that I understood you. What is is exactly that you mean or want to accomplish by doing that? Because this has nothing to do with the custom profile mod.

Costum profile mod add the ability to add costum fields to the postbit on the display.template.php

I just want to add this trick (the memdetails div) to the field that I have in my postbit

this is the code from the mod in the display template, how to add this trick to the mod?
Code: [Select]
              global $sourcedir, $messagevars;
$messagevars = $message;
require_once($sourcedir . '/CustomProfile.php');
DisplayFieldPosts();

I don''t think you can add this through the custom profile mod.

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #7 on: August 26, 2008, 09:31:59 AM »
You could if you arranged the styling in CustomProfile.php.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Offline ormuz

  • Full Member
  • ***
  • Posts: 677
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #8 on: August 26, 2008, 03:17:36 PM »
You could if you arranged the styling in CustomProfile.php.

I ask that in the mod support topic, but a smf moderator remove my doubt there...

Offline ccbtimewiz

  • SMF Hero
  • ******
  • Posts: 5,300
  • Gender: Male
  • OXEN
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #9 on: August 26, 2008, 04:05:33 PM »
Try out this:

Code: [Select]
echo '<div class="memdetails">', DisplayFieldPosts(), '</div>';

Offline ormuz

  • Full Member
  • ***
  • Posts: 677
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #10 on: August 26, 2008, 07:00:10 PM »
Try out this:

Code: [Select]
echo '<div class="memdetails">', DisplayFieldPosts(), '</div>';

That was my first try, and it works! But if the custom field is empty, it show the div too... Any ideas?

Offline ccbtimewiz

  • SMF Hero
  • ******
  • Posts: 5,300
  • Gender: Male
  • OXEN
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #11 on: August 26, 2008, 07:03:52 PM »
Try out this:

Code: [Select]
echo '<div class="memdetails">', DisplayFieldPosts(), '</div>';

That was my first try, and it works! But if the custom field is empty, it show the div too... Any ideas?

Yes.

if( DisplayFieldPosts() = true ) { echo '<div class="memdetails">', DisplayFieldPosts(), '</div>'; }

babjusi

  • Guest
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #12 on: August 27, 2008, 08:54:58 AM »
You could if you arranged the styling in CustomProfile.php.

Maybe, I am not familiar with the mod in question.

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #13 on: August 27, 2008, 10:07:24 AM »
Try out this:

Code: [Select]
echo '<div class="memdetails">', DisplayFieldPosts(), '</div>';

That was my first try, and it works! But if the custom field is empty, it show the div too... Any ideas?

No need to do anything more, the user figured it out.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

babjusi

  • Guest
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #14 on: September 01, 2008, 12:24:51 PM »

Offline ccbtimewiz

  • SMF Hero
  • ******
  • Posts: 5,300
  • Gender: Male
  • OXEN
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #15 on: September 01, 2008, 12:30:56 PM »
Perhaps a better title would be better... borderdataontopicview is kinda off the tongue. :P

babjusi

  • Guest
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #16 on: September 01, 2008, 12:48:17 PM »
Perhaps a better title would be better... borderdataontopicview is kinda off the tongue. :P

It could be, but at the moment when I made it couldn''t find a better name for it :D

Offline ormuz

  • Full Member
  • ***
  • Posts: 677
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #17 on: September 01, 2008, 04:35:33 PM »
The name shloud be "Vb postbit"

babjusi

  • Guest
Re: [Tip&trick] Bordered Post Data in Topic View
« Reply #18 on: September 03, 2008, 08:08:50 AM »
The name shloud be "Vb postbit"

I like that.

Offline Smoky "Rider" Blue

  • SMF Hero
  • ******
  • Posts: 1,682
  • Gender: Female
  • It's all in your head! :p
    • smoky.blue.01 on Facebook
Re: [Tip&trick] Vb postbit
« Reply #19 on: September 05, 2008, 12:19:22 AM »
you did a great job with this babjusi, thanks for sharing! :)
Currently in secondlife, contact me for any image creation via "pm" thanks!

**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**