Jump to content

Using HTTP_REFERER in Smarty TPL Files


Recommended Posts

Hi all, any help on this problem would be massively appreciated, I am essentially looking to add a css file into the header.tpl if the http_referer equals utm_medium=cpc, now obviously in a php file I would use the below however I am not too familiar with Smarty and the best way of acheiving this in the header.tpl file

 

<?php

session_start();

if (!isset($_SESSION["origURL"]))

$_SESSION["origURL"] = $_SERVER["HTTP_REFERER"];

?>

 

 

<?php

$_SESSION['org_referer'] = $_SERVER['HTTP_REFERER'];

if (strpos($_SESSION['origURL'], 'utm_medium%3Dcpc') !== false)

echo "<link href="/themes/theme1/css/standard.css" rel="stylesheet" type="text/css" media="all" />";

else

echo "<link href="/themes/theme1/css/ppc.css" rel="stylesheet" type="text/css" media="all" />";

?>

 

Anyone with any thoughts on this or can point me in the right direction for some good resources to read up on?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...