PDA

View Full Version : Fetching childforums ID?


masterross
07-02-2014, 09:08 AM
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:
$show['forum_google_ads'] = in_array(1, explode(',', $foruminfo['parentlist']));

then in the ad manager use
<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!