Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Toggle Function Problem

Asked Modified Viewed 1,312 times
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
asked
Senior Member

I'm hoping someone can help me with this problem. It is my home-made blog infusion. What I have done is take some old code from a really old early version7 panel called User_Activity_Panel v1.02 that I created a long while back for Fusion v7. Within that panel is a javascript function called 'toggle_xxxxx()' which basically toggles the users displayed in the panel via a 'show more users' link. Here are 2 images of the results I'm getting:
This first pic shows my module w/items and the Show More link.

whisperwillow.net/stuff/blog1.jpg


This second pic shows my module w/items after clicking the Show More link. The RED arrows denote the problem.

whisperwillow.net/stuff/blog2.jpg


As you can see the last item in the 1st pic is duplicated in the 2nd pic. I don't know what I am doing wrong and can't figure out why this is happening. Here is my entire script:
<?php
echo "<div class='col-sm-12'>n";
echo "<table width='100%' border='0'><tr><td><span class='hdspan2'><b>".$locale['gb_809']."</b></span><p></td></tr></table>n";
$min = 4;   // minimum visible bloggers in first level
$max = 12;   // maximum number of bloggers in second level (hidden)
echo "
<!--
function toggle_bloggers() {
   var smu = document.getElementById('show_more_bloggers');
   var smutxt = document.getElementById('show_more_bloggers_text');
   if (smu.style.display == 'none') {
      smu.style.display = 'block';
      smutxt.innerHTML = 'Show Less ...';
   } else {
      smu.style.display = 'none';
      smutxt.innerHTML = 'Show More ...';
   }
}
//-->
";
echo "<table align='center' width='70%' class=''>n";
$result = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_ACCOUNTS." ORDER BY reg_time DESC LIMIT ".($min + $max)."");
if (dbrows($result)) {
   $count = 0;
   while($data = dbarray($result)) {
      $user = $data['user_dude'];
      $pic = $data['avatar'];
      $timestamp = strtotime($data['reg_time']);
echo "<tr><td><img style='max-width:15px;height:auto; border-radius:50%' src='".BASEDIR."grims_blog/avatars/$pic' title='$user' /><a class='lnk-side' href='".BASEDIR."grims_blog/public_profiles.php?user_dude=".$user."'>$user</a> <span class='lnk-side-span'>Joined ".date("M Y", $timestamp)."</span></td></tr>n";
   if ($count == $min) {
echo "</table>n";
echo "<div><a class='lnk-side' href="nojavascript...void(0)" >"toggle_bloggers();"><span id='show_more_bloggers_text'>Show More ...</span></a>n";
echo "<div id='show_more_bloggers' style='display: none;'><table align='center' width='70%' class=''>n";
echo "<tr><td><img style='max-width:15px;height:auto; border-radius:50%' src='".BASEDIR."grims_blog/avatars/$pic' title='$user' /><a class='lnk-side' href='".BASEDIR."grims_blog/public_profiles.php?user_dude=".$user."'>$user</a> <span class='lnk-side-span'>Joined ".date("M Y", $timestamp)."</span></td></tr>n";
      }
   $count++;
   }
}
echo "</table>";
if ($count > $min) { echo "</div>n"; }
echo "<p></div>n";
?>

Any help would be appreciated. You can see it live here. To be precise, the javascript toggle function actually works as expected except for this one anomaly that I haven't been able to solve. Surely someone can see the problem?
https://windy.whisperwillow.net/grims.../index.php
Edited by Grimloch on 05-09-2021 16:50,
0 replies

3 posts

G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

OK guys; I guess you're all too busy with your own stuff. Well not to worry this can be closed because I figured it out my damn self!
0 replies
R
Anonymous User
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions
answered
Veteran Member

It's a community, so everyone can help each other, but it looks like the people who really know php are gone and now there are those who don't know php or know the minimum of php. And these people then have to wait for the core developers (last months only me..). But I don't always have time, so I recommend using Google. This is how it works, you don't know something -> Google.

I always try to find a solution myself. The Internet is full of tutorials. You can solve the problem much faster than waiting for an answer.
1 reply
R
Anonymous User
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions
answered
Veteran Member

It's up to you.

Btw. I don't want to offend you or something. But you don't always get an answer here in a few hours. So if you find it yourself, you'll have it faster.
1 reply

Labels

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

G
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
R
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet