vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Fetching childforums ID? (https://vborg.vbsupport.ru/showthread.php?t=312626)

masterross 07-02-2014 09:08 AM

Fetching childforums ID?
 
Guys can you give me a hand?

I'm trying to fetch Childforums IDs from forumids array but stuck with fetch_child_forums.

Thx!

kh99 07-02-2014 09:23 AM

What problem are you having? It looks like fetch_child_forums returns a comma separated string by default, although you can pass 'ARRAY' as the secon parameter to get an array of ids instead. It uses $allforumcache, so I suppose it's possible that that's not set where you're trying to call it.

masterross 07-02-2014 09:59 AM

Hi,

I want use it in Manage ADs as condition something like:
in_array($GLOBALS[forumid], array($foruminfo['childlist'])



But cant figure it out.


kh99 07-02-2014 10:08 AM

What condition are you trying to check for? It looks like what you have is checking if the current forum is in it's own child list.

masterross 07-02-2014 10:59 AM

I want to use Google Ads in some forums and included sub-forums.
For example:
- main forum (forumid 1)
-- childforum (forumid 2)
-- childforum (forumid 3)
-- childforum (forumid 4)
-- etc...

So I saw that in childlist field is written also the parent forum too (1,2,3,4,5,...etc) and I thought I can use it.

kh99 07-02-2014 12:25 PM

Well, there is also a parentlist, so I think what you'd want to do is check the parentlist for forumid 1 (if 1 is the actual parent forum id). But the problem is that parentlist is a comma separated list, so in_array() won't work. You could call explode() to make an array, but you can't use explode() in a template condition. So I can't think of any way except to have a plugin to help out. For example, you might make a plugin like this:
Code:

$show['forum_google_ads'] = in_array(1, explode(',', $foruminfo['parentlist']));
then in the ad manager use
Code:

<vb:if condition="$show[forum_google_ads]">
...
</vb:if>


masterross 07-02-2014 02:33 PM

Thx mate!

This was really easy.
I lost whole my day :)

Thx again!


All times are GMT. The time now is 01:02 PM.

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.01209 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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