IF variable for forum id?

Discussion forum for MOD Writers regarding MOD Development.
SuperFedya
Registered User
Posts: 253
Joined: Sun Jul 14, 2002 9:14 pm

IF variable for forum id?

Post by SuperFedya »

I need to show 1 line only for specific forum.
Something like "<!-- IF FORUM_ID is 33 -->bla-bla-bla<!-- ENDIF -->
Forum id is 33.
Any ideas?
User avatar
Rahber
Former Team Member
Posts: 2720
Joined: Tue Feb 12, 2008 3:39 pm
Location: Pakistan
Name: Rahber

Re: IF variable for forum id?

Post by Rahber »

Code: Select all

<!-- IF FORUM_ID eq '33' --> the one line you want to show<!-- ENDIF --> 
SuperFedya
Registered User
Posts: 253
Joined: Sun Jul 14, 2002 9:14 pm

Re: IF variable for forum id?

Post by SuperFedya »

Thanks! Works great!
atoirtap
Registered User
Posts: 63
Joined: Thu Aug 01, 2013 8:34 pm

Re: IF variable for forum id?

Post by atoirtap »

Hi buddies. Is there a similar expression to be used with forum-links? I mean, something like

<!-- IF FORUM_LINK_ID eq 'whatever' -->

do things

<!-- ENDIF -->

Thanks.
atoirtap
Registered User
Posts: 63
Joined: Thu Aug 01, 2013 8:34 pm

Re: IF variable for forum id?

Post by atoirtap »

Anyone?
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: IF variable for forum id?

Post by Lumpy Burgertushie »

what is a "forum link"?


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
atoirtap
Registered User
Posts: 63
Joined: Thu Aug 01, 2013 8:34 pm

Re: IF variable for forum id?

Post by atoirtap »

Type of forum: link :roll:
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: IF variable for forum id?

Post by Lumpy Burgertushie »

yes, I know that but what are you trying to do? a link type forum is still just a forum and therefore an IF statement would work exactly the same as any other IF statement for a given forum ID.

I assumed that you must be talking about something else since that is how it works already.

robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53569
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: IF variable for forum id?

Post by Brf »

The original question was how to identify the forum_id in viewtopic.php.
You will never be in viewtopic.php for a link forum.
regazer
Registered User
Posts: 69
Joined: Sun Sep 08, 2013 7:11 pm
Name: Reginald Gazer

Re: IF variable for forum id?

Post by regazer »

@atoirtap:
Maybe good to look into the file "functions.php" to find out, what can be used with "_ID" - just for a quick look I found: unique_id, style_id, $user_id, $forum_id, $topic_id, $f_id, $session_id, reportee_id, $item_id, session_user_id

Mabe there are more, maybe some are not really usable.

Best you try it out.
atoirtap
Registered User
Posts: 63
Joined: Thu Aug 01, 2013 8:34 pm

Re: IF variable for forum id?

Post by atoirtap »

Hi again, buddies.

@regazer
Yep, I was having a look to common.php, functions.php and other files, and searching around here before adding my question ;)

@lumpy
Yep, before asking, I tried using <!-- IF FORUM_ID eq 'whatever' --> as in the case of a 'normal' kind of forum, but I didn't get my goal, so I thought maybe in this case another variable should be used.

I would like to add a small link besides the name/description of a forum link. Depending of the forum id, the url should be one or another. So I thought to make a little hack in forumlist_body.html:

Original code:

Code: Select all

...
<!-- ELSEIF not forumrow.S_IS_LINK -->
things
<!-- ELSE -->
<dd>&nbsp;</dd>
<!-- ENDIF -->
...
My proposal (not working):

Code: Select all

...
<!-- ELSEIF not forumrow.S_IS_LINK -->
things
<!-- ELSE -->
 <!-- IF FORUM_ID eq 'whatever1' --><a href="blah1">bleh1</a><!-- ENDIF -->
  <!-- IF FORUM_ID eq 'whatever2' --><a href="blah2">bleh2</a><!-- ENDIF -->
<!-- ENDIF -->
...
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: IF variable for forum id?

Post by Lumpy Burgertushie »

ELSEIF doesn't work unless there is a previous IF

you can do IF blah blah ELSEIF blah blah

robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
atoirtap
Registered User
Posts: 63
Joined: Thu Aug 01, 2013 8:34 pm

Re: IF variable for forum id?

Post by atoirtap »

Hi Robert, thanks for answering again. Obviously there's a previous IF. The three dots ... before and after the shown code block mean that there are more lines before and after of that block, and I just wrote the portion of shown code to avoid make it too long.
regazer
Registered User
Posts: 69
Joined: Sun Sep 08, 2013 7:11 pm
Name: Reginald Gazer

Re: IF variable for forum id?

Post by regazer »

maybe it has to be something like this

Code: Select all

<!-- ELSE -->

<!-- IF FORUM_ID eq 'whatever1' --><a href="blah1">bleh1</a>
<!-- ELSEIF FORUM_ID eq 'whatever2' --><a href="blah2">bleh2</a>
<!-- ELSEIF FORUM_ID eq 'whatever*' --><a href="blah*">bleh*</a>
<!-- ELSE --><a href="blubb">blop</a>
<!-- ENDIF -->
 
<!-- ENDIF -->
:roll:

instead of eq I think == can be used and instead of single quote ' the double quote "


edit: after testing this I think you want to do that all in the wrong place. forumlist_body.html can't be it.
atoirtap
Registered User
Posts: 63
Joined: Thu Aug 01, 2013 8:34 pm

Re: IF variable for forum id?

Post by atoirtap »

regazer wrote:maybe it has to be something like this

Code: Select all

<!-- ELSE -->

<!-- IF FORUM_ID eq 'whatever1' --><a href="blah1">bleh1</a>
<!-- ELSEIF FORUM_ID eq 'whatever2' --><a href="blah2">bleh2</a>
<!-- ELSEIF FORUM_ID eq 'whatever*' --><a href="blah*">bleh*</a>
<!-- ELSE --><a href="blubb">blop</a>
<!-- ENDIF -->
 
<!-- ENDIF -->
:roll:

instead of eq I think == can be used and instead of single quote ' the double quote "


edit: after testing this I think you want to do that all in the wrong place. forumlist_body.html can't be it.
Hi buddy, where do should I do that?

Return to “[3.0.x] MOD Writers Discussion”