View Full Version : 4 Referer sites
CraiovaOnLine
09-17-2007, 08:52 AM
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
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.
<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:
if (strpos($_SERVER['HTTP_REFERER'], 'www.x.') != false)
{
$show['truereferrer'] = true;
}
else
{
$show['truereferrer'] = false;
}
In navbar use <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
You can put PHP code in if conditions, like this.
<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
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! :)
Dismounted
09-19-2007, 04:49 AM
You cannot use php functions that are not in the template safe functions list. I'm pretty sure strpos is not in the list.
Safe Functions List:
in_array()
is_array()
is_numeric()
isset()
empty()
defined()
array()
can_moderate()
can_moderate_calendar()
exec_switch_bg()
is_browser()
is_member_of()
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.