vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   4 Referer sites (https://vborg.vbsupport.ru/showthread.php?t=158022)

CraiovaOnLine 09-17-2007 08:52 AM

4 Referer sites
 
I need to put somthing like
if ( strpos($_SERVER['HTTP_REFERER'], 'www.x.')
in my template

What sould this do? well it would show somthing new for the users that camed from that referer

can u help me translate that in vb template code?

Eikinskjaldi 09-17-2007 11:20 AM

Quote:

Originally Posted by CraiovaOnLine (Post 1340705)
I need to put somthing like
if ( strpos($_SERVER['HTTP_REFERER'], 'www.x.')
in my template

What sould this do? well it would show somthing new for the users that camed from that referer

can u help me translate that in vb template code?

You cannot put php in templates, they are just html with a bit of variable substitution.
Put the code in...well the code, basically. Use in if conditional to display differential data in the html

nico_swd 09-17-2007 11:59 AM

You can put PHP code in if conditions, like this.
HTML Code:

<if condition="strpos($_SERVER['HTTP_REFERER'], 'www.x.') !== false">

    <!-- show your content here //-->

</if>


CraiovaOnLine 09-17-2007 03:57 PM

The following template conditional expression contains function calls:

<if condition="strpos($_SERVER['HTTP_REFERER'], 'www.x.') !== false">

Function Name Usage in Expression
strpos strpos($_SERVER[\'HTTP_REFERER\'], \'x.\')

With a few exceptions, function calls are not permitted in template conditional expressions. Please go back and re-write this expression.

The following functions are allowed in template conditional expressions:
in_array() is_array() is_numeric() isset() empty() defined() array() can_moderate() can_moderate_calendar() exec_switch_bg() is_browser() is_member_of()

any other ideeas plzzz

WhaLberg 09-17-2007 07:46 PM

In where you want to use this code? Forumhome?

CraiovaOnLine 09-18-2007 08:42 AM

navbar

WhaLberg 09-18-2007 06:10 PM

Add a plugin to global_start template including these codes:
PHP Code:

if (strpos($_SERVER['HTTP_REFERER'], 'www.x.') != false)
{
$show['truereferrer'] = true;
}
else
{
$show['truereferrer'] = false;


In navbar use
HTML Code:

<if condition="$show['truereferrer']">your codes</if>
By the way, I didn't test the php code but it should work. If you face any error, let me know.

CraiovaOnLine 09-18-2007 07:42 PM

works flawless

10x a lot.
Note 2 myself : When i get in turkey , gotta take u out for a beer .

Paul M 09-18-2007 08:32 PM

Quote:

Originally Posted by nico_swd (Post 1340790)
You can put PHP code in if conditions, like this.
HTML Code:

<if condition="strpos($_SERVER['HTTP_REFERER'], 'www.x.') !== false">

    <!-- show your content here //-->

</if>


You cannot use php functions that are not in the template safe functions list. I'm pretty sure strpos is not in the list.

WhaLberg 09-18-2007 09:09 PM

Quote:

Originally Posted by CraiovaOnLine (Post 1341949)
works flawless

10x a lot.
Note 2 myself : When i get in turkey , gotta take u out for a beer .

I'd love that.

Cheers! :)


All times are GMT. The time now is 11:52 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.01129 seconds
  • Memory Usage 1,739KB
  • 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
  • (3)bbcode_html_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete