Announcement

Collapse
No announcement yet.

parent forum id conditional?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • sinucello
    replied
    thanks for your suggestions. Unfortunately there would be no advantage in excluding forums as I need different banners per section. So I`d have as many IDs in the exclude list as I have in the include lists.

    maybe function 'construct_forum_bit' will help a little
    I have too little php knowledge to make a plugin out of this.


    So I still think that a conditional for a parent ID would be the best solution for me. In TypoScript (the scripting language of the TYPO3 CMS) you can do something like this:
    Code:
     [PIDinRootline = 3]
    but it seems that there`s just no equivalent to it in vB.


    My current code looks like this. It works but the long list of IDs is not very elegant ;-):


    Code:
     
    <vb:if condition="THIS_SCRIPT == 'index'">
            <!-- forum home -->
    
    
        <vb:elseif condition="THIS_SCRIPT == 'search'" />
            <!-- search -->
    
    
        <vb:elseif condition="THIS_SCRIPT == 'misc'" />
            <!-- chat -->
    
    
        <vb:elseif condition="in_array(THIS_SCRIPT, array('ppindex' , 'calendar' , 'usercp' , 'online' , 'album' , 'profile' , 'member' , 'subscription' , 'private' , 'showgroups' , 'group' , 'arcade'))" />
            <!-- social networking -->
    
    
        <vb:elseif condition="in_array(THIS_SCRIPT, array('register' , 'login', 'faq' , 'sendmessage', 'announcement'))" />
            <!-- corporate communication -->
    
    
        <vb:elseif condition="in_array($GLOBALS['forumid'], array('3','12','13','14','15','18','19','23','24','25','26','34','35','42','45','145','50','285','72','71','73','78','79','80','81','82','83','84','140','118','119','120','121','122','125','126','127','128','129','130','131','132','133','134','135','136','137','138','139','141','146','144','142','190','206','207','208','209','284','290','261','283','289','291','286','296','438','432','433','436','391','451','454','456','293','435','310','434','312','311','313','314','315','316','317','318','319','320','321','322','323','324','325','326','327','328','329','330','331','332','333','334','335','336','337','338','339','340','341','342','343','344','347','348','349','350','351','365','352','353','354','355','356','357','358','359','360','361','362','363','364','366','367','368','369','439','437','452','455','457','287','36','48','64','63','76','75','77','255','246','152','245','213','256','266','263','257','254','258','259','260','265','264','267','268','269','270','271','272','273','274','275','276','277','278','288','428','446','426','424','429','441','427','392','393','394','395','396','431','430','425','442','443','444','447','448','449','460','463','461','462'))" />
            <!-- entertainment and lifestyle -->
    
    
        <vb:elseif condition="in_array($GLOBALS['forumid'], array('8','21','30','39','40','41','43','47','49','52','54','60','61','66','96','74','85','87','88','90','89','91','93','94','116','98','100','113','101','104','106','108','109','110','112','114','115','117','123','124','294','153','157','179','170','171','172','173','174','175','176','177','180','178','181','182','188','183','184','185','186','187','189','191','192','193','196','197','199','198','243','242','240','241','249','307','306','308','440','398','453','459','464','5','22','292','58','244','236','238','247','248','250','253','279','280','303','298','299','300','301','302','370'))" />
            <!-- misc (multitopic) -->
    
    
        <vb:else />
            <!-- no IVW -->
    
    
    </vb:if>

    all the best,
    Sacha

    Leave a comment:


  • Abdulla Ashoor
    replied
    Code:
    <vb:if condition="in_array($forum['forumid'], array(1,2,3))">
    you could replace 'array(1,2,3)' with array containing child list that you prepared through a plugin. as far as I know there is no such $forum['childlist'] ready to use.

    I'm not sure what you are trying to do but seems in your case you just need to add !in_array.
    Instead of showing in forums, add forum ids that you don't want to show in.

    if those comment are not helpful maybe function 'construct_forum_bit' will help a little. you can find it in 'functions_forumlist.php' file.

    Leave a comment:


  • sinucello
    started a topic parent forum id conditional?

    parent forum id conditional?

    Hi,

    I use the following code to add some banners to certain forums in the header template:
    Code:
    <vb:elseif condition="in_array($GLOBALS['forumid'], array('3' , '391'))" />
    before I start to add more than hundred subforums to this list, I`d love to know if it is possible to also base the condition on the parent ID or even parentlist.

    Example:

    My forum structure is:

    Code:
    3
      4
        5
        6
      7
        8
        9
      10
    The parent ID of forum number 6 would be 4. So a conditional based on parent ID 4 would result in 5 and 6. But if I wanted all sub-forums of forum/category number 3 (top level) in the result, I`d have to ask if the ID 3 is contained in the field parentlist.

    With SQL I`d this:
    Code:
    SELECT forumid FROM `forum` WHERE
            (
                LOCATE(',3,', CONCAT(',',parentlist,','))>0 OR
                LOCATE(',3,', CONCAT(',',parentlist,','))>0
            );
    But how to do this with conditionals? Is this possible?

    btw.: the above mentioned SQL statement is a very good way to receive all sub-forum IDs of a given category or parent forum recursively if you need them for the classic array with list-of-IDs conditional.

    thank you - all the best,
    Sacha
    Last edited by sinucello; Thu 10 May '12, 9:55am.

Related Topics

Collapse

Working...
X