vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Conditional only if in childforum (https://vborg.vbsupport.ru/showthread.php?t=319599)

Kwikms 07-22-2015 04:20 PM

Conditional only if in childforum
 
Lets say I have 6 forums:

Main-1
- Sub -2
Another-Main-3
- Other-Sub-4
- Another-Sub-5
-- Sub-of-Another-Sub-6

I am looking for a way to check, if a forum is a childforum of a certain forum.

Like this, but I only want to put in the main forum.

<vb:if condition="in_array($forum['forumid'], array(3))"></vb:if>
<vb:if condition="$forum[forumid] == 3"></vb:if>

In this excample if I say ID 3 (which is "Another-Main-3") I want the conditional also be true if the user is in forum 4,5 and 6.

Any ideas how I can achive this?

MarkFL 07-22-2015 04:25 PM

Try using $foruminfo['parentlist'] to check to see if the forum is a child of forumid = 3.

Kwikms 07-22-2015 04:34 PM

You mean like this?

<vb:if condition="$foruminfo['parentlist'] == 3"></vb:if>

MarkFL 07-22-2015 05:24 PM

No, the variable $foruminfo['parentlist'] is an array, so you need:

HTML Code:

<vb:if condition="in_array(3, $foruminfo['parentlist'])"></vb:if>

Kwikms 07-22-2015 05:40 PM

Thanks, but doesnt work for me :(

I can access {vb:raw $foruminfo['parentlist']} but I cant use it in a conditional.

--------------- Added [DATE]1437594358[/DATE] at [TIME]1437594358[/TIME] ---------------

I want to modify the title in some subforums. I guess I have to write a plugin anyway...

squidsk 07-22-2015 07:16 PM

Because you don't use {vb:raw . . . } inside a conditional, use the code Mark provided in his post.


All times are GMT. The time now is 07:52 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01496 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete