MyBB Community Forums

Full Version: How do I hide Sub Forums if there isn't one?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2016-09-12, 11:18 PM)aradabir007 Wrote: [ -> ]
(2016-09-12, 11:01 PM)Ashley1 Wrote: [ -> ]What do you have in forumbit_subforums template ?

This whole div should be ideally be placed there, then subforums will only appear when there are subforums.

        <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
          <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
            <span class="forumhome_subforum_text">{$lang->subforums}</span>
          </a>
          <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
               {$sub_forums}
          </ul>
        </div>

When I add this to forumbit_subforums, nothing happens

(2016-09-12, 11:17 PM)alfred702 Wrote: [ -> ]
(2016-09-12, 10:32 PM)aradabir007 Wrote: [ -> ]
(2016-09-12, 11:49 AM)effone Wrote: [ -> ]Assuming the dropdown is by jQuery : You have to modify the dropdown function with a conditional check.
I don't have your code so here is an example for you to guide if you can get the idea from it:

$('#subforum').click(function(){
    if($(this).children().length > 0){
       // Initiate Dropdown ...
    }
});

NB: If you wanna use commom class for multiple dropdowns instead of id : try ".closest('class_name')" method.

I get it but I don't know how to apply this. So here is the code for the dropdown menu which is in the forumbit_depth2_forum template.

  <div class="forumhome_forum_bit" id="forum2">
        <div class="forumhome_forumbit_left" style="width: 100% !important; height: 100% !important;">
          <img src="images/bos.png" id="forum_statusicon_2">
          <a href="{$forum_url}">
            <span class="forumhome_forum_text">{$forum['name']}</span>
          </a>
        </div>
        <div class="forumhome_forumbit_right">

          <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
            <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
              <span class="forumhome_subforum_text">{$lang->subforums}</span>
            </a>
            <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
				{$sub_forums}
            </ul>
          </div>


          <div id="forumhome_forumbit_lastpost">
           {$lastpost}
          </div>


        </div>
      </div>

This is the code that shows Sub Forums: menu. I guess it's not using jQuery, is it? The theme includes Bootstrap and using its dropdown feature. Can you help me with that?

(2016-09-12, 11:00 AM)Ashley1 Wrote: [ -> ]You should ask the theme creator for support, this does not happen with a default theme.

I can't because It was a custom made theme but the freelancer just ran away after he took the money and abandoned it. Undecided

My friend, I believe I have the answer you're looking for.  


<span class="forumhome_subforum_text">{$lang->subforums}</span>
</a>


Change that to this:

<span class="forumhome_subforum_text">&nbsp;</span>
</a>


This would display a blank space rather then the word Sub Forums.
To take this a step further, you could try running a search for the $subforums template.  Do you know how to do that?  And why don't you try learning how to build the template yourself?  It's actually quite easy and fun once you get the hang of it!

This removed the Sub Forums: text even if there are subforums. So this didn't work. I don't know how to do that.
Templates -> Search and Replace
Maybe you are looking in the wrong template set I don't know. What i gave should work, poorly coded template obviously.
(2016-09-12, 11:30 PM)alfred702 Wrote: [ -> ]
(2016-09-12, 11:18 PM)aradabir007 Wrote: [ -> ]
(2016-09-12, 11:01 PM)Ashley1 Wrote: [ -> ]What do you have in forumbit_subforums template ?

This whole div should be ideally be placed there, then subforums will only appear when there are subforums.

        <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
          <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
            <span class="forumhome_subforum_text">{$lang->subforums}</span>
          </a>
          <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
               {$sub_forums}
          </ul>
        </div>

When I add this to forumbit_subforums, nothing happens

(2016-09-12, 11:17 PM)alfred702 Wrote: [ -> ]
(2016-09-12, 10:32 PM)aradabir007 Wrote: [ -> ]
(2016-09-12, 11:49 AM)effone Wrote: [ -> ]Assuming the dropdown is by jQuery : You have to modify the dropdown function with a conditional check.
I don't have your code so here is an example for you to guide if you can get the idea from it:

$('#subforum').click(function(){
    if($(this).children().length > 0){
       // Initiate Dropdown ...
    }
});

NB: If you wanna use commom class for multiple dropdowns instead of id : try ".closest('class_name')" method.

I get it but I don't know how to apply this. So here is the code for the dropdown menu which is in the forumbit_depth2_forum template.

  <div class="forumhome_forum_bit" id="forum2">
        <div class="forumhome_forumbit_left" style="width: 100% !important; height: 100% !important;">
          <img src="images/bos.png" id="forum_statusicon_2">
          <a href="{$forum_url}">
            <span class="forumhome_forum_text">{$forum['name']}</span>
          </a>
        </div>
        <div class="forumhome_forumbit_right">

          <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
            <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
              <span class="forumhome_subforum_text">{$lang->subforums}</span>
            </a>
            <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
				{$sub_forums}
            </ul>
          </div>


          <div id="forumhome_forumbit_lastpost">
           {$lastpost}
          </div>


        </div>
      </div>

This is the code that shows Sub Forums: menu. I guess it's not using jQuery, is it? The theme includes Bootstrap and using its dropdown feature. Can you help me with that?

(2016-09-12, 11:00 AM)Ashley1 Wrote: [ -> ]You should ask the theme creator for support, this does not happen with a default theme.

I can't because It was a custom made theme but the freelancer just ran away after he took the money and abandoned it. Undecided

My friend, I believe I have the answer you're looking for.  


<span class="forumhome_subforum_text">{$lang->subforums}</span>
</a>


Change that to this:

<span class="forumhome_subforum_text">&nbsp;</span>
</a>


This would display a blank space rather then the word Sub Forums.
To take this a step further, you could try running a search for the $subforums template.  Do you know how to do that?  And why don't you try learning how to build the template yourself?  It's actually quite easy and fun once you get the hang of it!

This removed the Sub Forums: text even if there are subforums. So this didn't work. I don't know how to do that.
Templates -> Search and Replace

Usually html forms like that support a default parameter and I'm sure you could fix it if you could edit the source code.

(2016-09-12, 11:31 PM)Ashley1 Wrote: [ -> ]Maybe you are looking in the wrong template set I don't know. What i gave should work, poorly coded template obviously.

I agree.

Because this is a custom template please check your GLOBAL templates, as well as your UNGROUPED templates (very bottom of your themes templates) and you should fine the code you are looking for!

Once you find it, post it here again and we can probably help you
You guys can login with admin info so you can look through the templates?

id: admin
pass: admin123

http://139.59.146.117/admin/index.php
(2016-09-12, 11:38 PM)aradabir007 Wrote: [ -> ]You guys can login with admin info so you can look through the templates?

id: admin
pass: admin123

http://139.59.146.117/admin/index.php

Err you shouldn't do it like that, everyone can log each other out.  Just PM it to me with a more complex password lol
Okay If someone wants to help I can create him/her an account for admincp. Just let me know please. And I appreciate all the help you guys provided. Thanks! Smile

Still couldn't fix the problem tho
Bump. I still need help. Couldn't figure out how to fix this
Maybe you should cut your losses with this theme, it's not the only problem with this theme if the intention was to build a responsive bootstrap theme.
$('#subforum').click(function(){
   if($(this).children().length > 0){
      // Initiate Dropdown ...
   }
});

NB: If you wanna use commom class for multiple dropdowns instead of id : try ".closest('class_name')" method.

I get it but I don't know how to apply this. So here is the code for the dropdown menu which is in the forumbit_depth2_forum template.

Code:
 <div class="forumhome_forum_bit" id="forum2">
       <div class="forumhome_forumbit_left" style="width: 100% !important; height: 100% !important;">
         <img src="images/bos.png" id="forum_statusicon_2">
         <a href="{$forum_url}">
           <span class="forumhome_forum_text">{$forum['name']}</span>
         </a>
       </div>
       <div class="forumhome_forumbit_right">

         <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
           <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
             <span class="forumhome_subforum_text">{$lang->subforums}</span>
           </a>
           <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
                {$sub_forums}
           </ul>
         </div>


         <div id="forumhome_forumbit_lastpost">
          {$lastpost}
         </div>


       </div>
     </div>

Ok so from what I can see, 
 <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
           <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
             <span class="forumhome_subforum_text">{$lang->subforums}</span>
Is the snippet we are looking at. Have you tried searching css for subforums? Subforum or forumbit? 
You can tell by the way the code is written, that divid=forumhome_forumbit_subforuns, that it refers back to css(or edit the theme xml). Its possible the links and titles can be edited there
(2016-09-17, 04:12 AM)izakgewdrick Wrote: [ -> ]$('#subforum').click(function(){
   if($(this).children().length > 0){
      // Initiate Dropdown ...
   }
});

NB: If you wanna use commom class for multiple dropdowns instead of id : try ".closest('class_name')" method.

I get it but I don't know how to apply this. So here is the code for the dropdown menu which is in the forumbit_depth2_forum template.

Code:
 <div class="forumhome_forum_bit" id="forum2">
       <div class="forumhome_forumbit_left" style="width: 100% !important; height: 100% !important;">
         <img src="images/bos.png" id="forum_statusicon_2">
         <a href="{$forum_url}">
           <span class="forumhome_forum_text">{$forum['name']}</span>
         </a>
       </div>
       <div class="forumhome_forumbit_right">

         <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
           <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
             <span class="forumhome_subforum_text">{$lang->subforums}</span>
           </a>
           <ul class="forumhome_dropdown_menu dropdown-menu" role="menu">
                {$sub_forums}
           </ul>
         </div>


         <div id="forumhome_forumbit_lastpost">
          {$lastpost}
         </div>


       </div>
     </div>

Ok so from what I can see, 
 <div id="forumhome_forumbit_subforums" class="hidden-xs hidden-sm">
           <a data-toggle="dropdown" href="#" role="button" aria-expanded="false">
             <span class="forumhome_subforum_text">{$lang->subforums}</span>
Is the snippet we are looking at. Have you tried searching css for subforums? Subforum or forumbit? 
You can tell by the way the code is written, that divid=forumhome_forumbit_subforuns, that it refers back to css(or edit the theme xml). Its possible the links and titles can be edited there

I really don't know how and where to add this code:

$('#subforum').click(function(){
   if($(this).children().length > 0){
      // Initiate Dropdown ...
   }
});

Can you help me with that?
Pages: 1 2 3