TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 606
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 447
  • Total: 447

How about a List Block

Started by rumboogy, March 07, 2008, 12:17:54 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

rumboogy

Hey JPDeni...First, let me say that I love the List Block. EXCELLENT little tool for LOTS of uses.

I do have a question...I notice right now it is set up to only accept an "X" in each field...(But I changed my to say "YES").

How hard would it be to pass TEXT over to the table.

My example...in Custom Profile Fields I set up a new FIELD called "Your Ride" and used a TEXT field. The member can use this small text box to type in their Bike Make and Model (ex. 2004 Honda VTX 1300s), so I am wanting to pass this value over to the table. Is this possible (right now I just get the "X" mark.

I have set it up here:  http://www.arkansasbiker.net/index.php?page=43

Of course this is just playing right now.

Just asking.

Wally

Solomon

#21
This is a very useful for my site, allowing our project managers to coordinate volunteer activities.
Thanks!

JPDeni

I'm glad you like it, Solomon.

rumboogy, it can be made to do what you want, but it would require either more data to be entered or more calls to the database. Actually, I have in the past used text fields for this, when our users had their seat numbers for conventions and wanted to be able to locate their friends or find out who was sitting close to them. That's when the coding was ugly. ;)

Let me think about it a bit and see if I can come up with something that's not too ugly.

rumboogy

Ok...let's see if I can do this without making an A$$ of myself...

I hope I explained myself good enough...

You are "DA GOIL"!  ;D

Thanks JPDeni!

Wally

JPDeni

LOL!!! Very good, Wally! (My husband got a chuckle out of that, too.)

Okay. This should do it. I'll post it here and also change it in the first post.


global $db_prefix, $scripturl;

//////////////////////////////////////////////////////////////////
/////                    I M P O R T A N T                   /////
/////                                                        /////
////    This can only be used in conjunction with the        /////
////    Custom Profile Fields mod, which is available        /////
////    at the SMF site.                                     /////
/////                                                        /////
//////////////////////////////////////////////////////////////////

// List the Field IDs that you have set in the Custom Profile Fields
// in the order you want them displayed on the list.
$codes = array("SDIF","GSCo","Bord","Rift","Unio","Coll");

// Enter the field type for each field, , using the field IDs as the subscript
// If the field is a checkbox, enter 1
// if it's anything else, enter some other number

$field_type['SDIF'] = 1;
$field_type['GSCo'] = 1;
$field_type['Bord'] = 1;
$field_type['Rift'] = 2;
$field_type['Unio'] = 7;
$field_type['Coll'] = 1;

// List the full names of the events, in the same order as the field IDs above
$event_name[] = "San Diego<br>Indie Music Fest<br>29 Mar";
$event_name[] = "Grand Slam<br>12 - 13 Apr";
$event_name[] = "The Rift<br>26 Apr";
$event_name[] = "The Borderline<br>30 Apr";
$event_name[] = "Union Chapel<br>2 May";
$event_name[] = "Collectormania<br>3 - 4 May";

///////////////////////////////////////////////////////////////////////////////////

if (isset($codes[0])) {

  $return = '';
  $nbsp = "&nb" . "sp;";

  $event = array();
  $member = array();
  $link = array();

  foreach ($codes as $c)
    ($field_type[$c] == 1) ? $q[] = "(variable LIKE '$c' AND value <>0)" : $q[] = "(variable LIKE '$c' AND value NOT LIKE '')";
  $qr = implode("OR ",$q);

  $query = db_query("SELECT realName, variable, value, th.ID_MEMBER
                     FROM {$db_prefix}themes as th,{$db_prefix}members as mem
                     WHERE ($qr)
                         AND th.ID_MEMBER = mem.ID_MEMBER
                     ORDER BY realName", __FILE__, __LINE__);
  while ($row = mysql_fetch_assoc($query))
  {
    $event[$row['realName']][$row['variable']] = $row['value'];
    $member[$row['realName']] = 1;
    $link[$row['realName']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';
  }
  mysql_free_result($query);
  uksort($member, 'strnatcasecmp');
  $return .= '<center><table border="1">
                <tr align="center"><td>Member</td>';
  foreach ($event_name as $e)
    $return .= "<td>$e</td>";
  $return .= '</tr>';
  foreach ($member as $key => $value)
  {
    $return .= '<tr align="center"><td>'.$link[$key].'</td>';
    foreach ($codes as $c)
    {
      $return .= '<td>';
        if (isset($event[$key][$c]))
        {
         ($field_type[$c] == 1) ? $return .= '<center>X</center>' : $return .= $event[$key][$c];
        }
        else { $return .= $nbsp; }
      $return .= '</td>';
    }
    $return .= '</tr>';
  }
  $return .= '</table></center><br /><br />';
  }
  else
    $return = "There are no pending events at the moment<br /><br />";

echo $return;

echo 'If your name is already here and you would like to update your entry, just click your name on the list
and then click <b>Forum Profile Information</b> in the left column. Scroll down a bit and you will see the section
where you can enter the data.<br />If your name is not yet on the list, look up at the top right corner of the page and
click <b>Profile</b>, and then look for <b>Forum Profile Information</b> in the left column.<br /> If you have any problems
at all, feel free to ask for help.';



I was thinking about the "X" or "Yes" to indicate that the person has selected the checkbox. It could also be a graphic. Lots and lots of possibilities.

rumboogy

Thank you JPDeni...Glad I could make your hubby chuckle. But if you don't mind...I won't tell my wife about my "fauxpau"  :uglystupid2:

Thanks, I'll try this out now.

Wally

rumboogy

Works like a CHARM!!

http://www.arkansasbiker.net/index.php?page=43

Ms. JPDeni...this may be the BEST little part of my TP...I like this a LOT.

This little snippet (article /w Custom Profile Fields) may have ENDLESS possibilities.

Thank you so much!

Wally

rumboogy


JPDeni

You're very welcome. Like I said, mine works better now, too, so we helped each other. And I had fun with it, too. :D

The images are very fun!  :D

The best part of TP is the way it helps you make your site your own. You don't end up with a cookie-cutter site. And the more you do, the more you realize what you can do.


rumboogy

QuoteThe best part of TP is the way it helps you make your site your own. You don't end up with a cookie-cutter site. And the more you do, the more you realize what you can do.

Absolutely right...but it also helps to have people like you and the others on this board to help us and for that, I am sure I speak for others when I say...

THANK YOU!

Wally

This website is proudly hosted on Crocweb Cloud Website Hosting.