vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   IF Condition for this? (https://vborg.vbsupport.ru/showthread.php?t=250791)

MarkFoster 09-19-2010 05:00 AM

IF Condition for this?
 
I am trying to display something on specific pages only. Is there an IF like this?:

Example only:

<if condition="url == http://example.com/example1.php"></if>

BigJohnny 09-19-2010 11:16 AM

depending on where you put it you might want to try <IF THIS_SCRIPT == "index">

that will show whatever the code is on the index only.

MarkFoster 09-19-2010 11:48 AM

Quote:

Originally Posted by BigJohnny (Post 2100435)
depending on where you put it you might want to try <IF THIS_SCRIPT == "index">

that will show whatever the code is on the index only.

I went to put it on specific members' profiles.

kh99 09-19-2010 12:17 PM

There are ways to check the url - there's a $_SERVER variable that has that info in various forms. Here's a reference: http://php.net/manual/en/reserved.variables.server.php (maybe $_SERVER['PHP_SELF'] is what you're talking about).

However, it sounds like what you want is to check the user id, like
Code:

<if condition="$bbuserinfo['userid']==X">

if you want to put something in a template that's also included in other pages you could do like BigJohnny said,
Code:

<if condition="THIS_SCRIPT=='member' AND $bbuserinfo['userid']==X">

and if you also want to show it for a page that has a "do=" on the URL (but only for certain values), there's a way to do that, too.
Code:

<if condition="$_REQUEST['do'] == 'something'>

MarkFoster 09-20-2010 07:51 AM

Quote:

Originally Posted by kh99 (Post 2100461)
There are ways to check the url - there's a $_SERVER variable that has that info in various forms. Here's a reference: http://php.net/manual/en/reserved.variables.server.php (maybe $_SERVER['PHP_SELF'] is what you're talking about).

However, it sounds like what you want is to check the user id, like
Code:

<if condition="$bbuserinfo['userid']==X">

if you want to put something in a template that's also included in other pages you could do like BigJohnny said,
Code:

<if condition="THIS_SCRIPT=='member' AND $bbuserinfo['userid']==X">

and if you also want to show it for a page that has a "do=" on the URL (but only for certain values), there's a way to do that, too.
Code:

<if condition="$_REQUEST['do'] == 'something'>

About what I marked in bold, user profiles do not have any "do="'s but they do have "?u=". Any way the IF could be changed for that?

Also, I want this displayed on specific user profiles. However, I want it seen by every member. That's the reason why I need an IF. I intend to place it right under the username on certain profiles, like user ID 1, 5 and 7, yet seen by everybody.

kh99 09-20-2010 09:47 AM

Oh, I see now - my mistake. I think you want:

Code:

<if condition="$userinfo['userid'] == X">
You can ignore the other stuff (you had asked about checking the url I so was trying to cover all bases).


All times are GMT. The time now is 10:48 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.01055 seconds
  • Memory Usage 1,725KB
  • 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
  • (7)bbcode_code_printable
  • (2)bbcode_quote_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