Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
how to add php command on .tpl
Old 04-28-2010, 09:51 PM how to add php command on .tpl
ZoC
Skilled Talker

Posts: 68
Trades: 0
hello there, my script is all just .tpl ... and im tryng to add this command on index.tpl

Code:
if (preg_match("~google.com~i", $_SERVER['HTTP_REFERER'])) { echo 'a'; } else { echo 'b'; }
can someone tell me how i can add this command ?
ZoC is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-28-2010, 10:12 PM Re: how to add php command on .tpl
ZoC
Skilled Talker

Posts: 68
Trades: 0
i try to add right now with this command but still not working ...

i make one .php

Code:
<?php
 function getReferer() {
  if (preg_match("~google.com~i", $_SERVER['HTTP_REFERER'])) { 
   $referer_web = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
  } else { 
   $referer_web = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';
  }
 }

 $referer_web = $referer_web;

 $smarty->assign('referer_web', $referer_web);
?>
and on tpl i add {$referer_web} and is not working ... can someone help me with this ?

Last edited by ZoC; 04-29-2010 at 12:50 AM..
ZoC is offline
Reply With Quote
View Public Profile
 
Old 04-29-2010, 06:25 AM Re: how to add php command on .tpl
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
PHP Code:
echo (preg_match("~google.com~i"$_SERVER['HTTP_REFERER'])) ? 'a' :  'b' 
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
Reply With Quote
View Public Profile
 
Old 04-29-2010, 07:36 AM Re: how to add php command on .tpl
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
how does the script read the .tpl file?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-29-2010, 10:46 AM Re: how to add php command on .tpl
Lashtal's Avatar
wherenomanhasgonebefore

Posts: 680
Name: Lashtal
Trades: 0
Quote:
Originally Posted by davidj View Post
PHP Code:
echo (preg_match("~google.com~i"$_SERVER['HTTP_REFERER'])) ? 'a' :  'b' 
good question.
__________________
Currently Reading:
Please login or register to view this content. Registration is FREE
Lashtal is offline
Reply With Quote
View Public Profile
 
Old 04-29-2010, 05:40 PM Re: how to add php command on .tpl
Novice Talker

Posts: 11
Name: Gary
Trades: 0
If you .tpl file is a smarty file then you need to enclose your php in these tags
{php}

if (preg_match("~google.com~i", $_SERVER['HTTP_REFERER'])) { echo 'a'; } else { echo 'b'; }

{/php}
__________________
This is my php magento promotional website
Please login or register to view this content. Registration is FREE
webchamp is offline
Reply With Quote
View Public Profile
 
Old 04-30-2010, 09:07 AM Re: how to add php command on .tpl
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
My Bad

Didn't read reqs properly
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
Reply With Quote
View Public Profile
 
Old 04-30-2010, 06:50 PM Re: how to add php command on .tpl
ZoC
Skilled Talker

Posts: 68
Trades: 0
hello there, thanks for the support but with more work i fix what i need ... but i still have one problem ... first time i will show my php code

Code:
<?php
 // On - Script Work
 $script = 'On';

 // Cod Html Ads For Referer
 $ads_im_referer = 'referer';
 $ads_video_referer = 'referer';

 // Cod Html Ads No Referer
 $ads_im_normal = 'no referer';
 $ads_video_normal = 'no referer';

 if ($script != "On") {
  // No Referer
  $ads_im = $ads_im_normal;
  $ads_video = $ads_video_normal;
 } else {
  if (preg_match("~myweb1.com~i", $_SERVER['HTTP_REFERER']) || preg_match("~myweb2.com~i", $_SERVER['HTTP_REFERER'])) { 
   // Referer
   $ads_im = $ads_im_referer;
   $ads_video = $ads_video_referer;
  } else { 
   // No Referer
   $ads_im = $ads_im_normal;
   $ads_video = $ads_video_normal;
  }
 }

 $smarty->assign('ads_im', $ads_im);
 $smarty->assign('ads_video', $ads_video);
?>
is working ! but the problem is if someone is come "Referer" and is click one link on my website after that the person is show "No Referer" is possible to i make all people who come from website1 and website2 to be referer ? just to dont be referer if they EXIT (close) the website

Last edited by ZoC; 04-30-2010 at 06:54 PM..
ZoC is offline
Reply With Quote
View Public Profile
 
Old 05-01-2010, 10:16 AM Re: how to add php command on .tpl
Lashtal's Avatar
wherenomanhasgonebefore

Posts: 680
Name: Lashtal
Trades: 0
create a session for this, and include session on all (necessary) pages.
__________________
Currently Reading:
Please login or register to view this content. Registration is FREE
Lashtal is offline
Reply With Quote
View Public Profile
 
Old 05-03-2010, 04:16 AM Re: how to add php command on .tpl
ZoC
Skilled Talker

Posts: 68
Trades: 0
how i can make this ?
ZoC is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to how to add php command on .tpl
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35488 seconds with 12 queries