Jump to content

alexasigno

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

alexasigno's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well i still cant get this sorted, i have refined the code slightly and it still just wont work within a smarty template. The following code works fine as a php file, how should i mark this up to work correctly? Many thanks <?php $URL = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; if ( $URL == "http://www.code-d.com/test.php" | $URL == "http://www.code-d.com/test.php"){ function add_filter($a,$b) { }; // this is a function that WordPress normally provides define("ABSPATH",'./'); // this is a constant that WordPress normally provides include 'inlineRSS.php'; // this is the unmodified inlineRSS.php file inlineRSS('travel'); // and finally, this is the call to your feed } $URL = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; if ( $URL == "http://www.code-d.com/test2.php" | $URL == "http://www.code-d.com/test2.php"){ function add_filter($a,$b) { }; // this is a function that WordPress normally provides define("ABSPATH",'./'); // this is a constant that WordPress normally provides include 'inlineRSS.php'; // this is the unmodified inlineRSS.php file inlineRSS('ski'); // and finally, this is the call to your feed } ?>
  2. Hi i have tried putting the code in an include file and have linked it in with {include_php file="/testfile.php"} However i get an error Warning: Smarty error: file:/travel/test.php is not readable in /home/alexf40/public_html/alexasigno/travel/libs/smarty/Smarty.class.php on line 1095 Any ideas? Thank you
  3. Hi i am trying to get the following code to work in the smarty template system, it all works fine normally but im not quite sure what i am doing wrong with the smarty template. If you could spare any help it would be most appreciated. Many thanks Alex {php} $URL = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; if ( $URL == "http://www.alexasigno.co.uk/travel/" | $URL == "http://www.alexasigno.co.uk/travel/index.php"){ function add_filter($a,$b) { }; // this is a function that WordPress normally provides define("ABSPATH",'./'); // this is a constant that WordPress normally provides include 'inlineRSS.php'; // this is the unmodified inlineRSS.php file inlineRSS('travel'); // and finally, this is the call to your feed } $URL = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; if ( $URL == "http://www.alexasigno.co.uk/travel/ski_holidays/" | $URL == "http://www.alexasigno.co.uk/travel/ski_holidays/index.php"){ function add_filter($a,$b) { }; // this is a function that WordPress normally provides define("ABSPATH",'./'); // this is a constant that WordPress normally provides include 'inlineRSS.php'; // this is the unmodified inlineRSS.php file inlineRSS('ski'); // and finally, this is the call to your feed {/php}
  4. Hi everyone, I would be most appreciative if someone could help me, i am trying to use the following piece of code into a smarty template which is causing a problem. This code is to be used to display a different rss feed depending on the page, hence there will be multiple versions of this. Ie if its a skiing page show this, if its a snowboarding page show this etc. <?php $URL = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; if ( $URL == "http://www.alexasigno.co.uk/travel/" | $URL == "http://www.alexasigno.co.uk/travel/index.php") : ?> <?php function add_filter($a,$b) { }; // this is a function that WordPress normally provides define("ABSPATH",'./'); // this is a constant that WordPress normally provides include 'inlineRSS.php'; // this is the unmodified inlineRSS.php file inlineRSS('travel'); // and finally, this is the call to your feed ?> <?php endif; ?> I have tried using the code in these tags {php} but i still cant get it to work, here is what i tried: <?php $URL = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; if ( $URL == "http://www.alexasigno.co.uk/travel/" | $URL == "http://www.alexasigno.co.uk/travel/index.php") : ?> <?php function add_filter($a,$b) { }; // this is a function that WordPress normally provides define("ABSPATH",'./'); // this is a constant that WordPress normally provides include 'inlineRSS.php'; // this is the unmodified inlineRSS.php file inlineRSS('travel'); // and finally, this is the call to your feed ?> <?php endif; ?> {php} $URL = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; if ( $URL == "http://www.alexasigno.co.uk/travel/ski_holidays/" : {/php} {php} function add_filter($a,$b) { }; // this is a function that WordPress normally provides define("ABSPATH",'./'); // this is a constant that WordPress normally provides include 'inlineRSS.php'; // this is the unmodified inlineRSS.php file inlineRSS('ski'); // and finally, this is the call to your feed {/php} {/php} It would be great if your are able to help or shed any ideas. Many thanks Alex
  5. Thankyou wildteen88 school boy error!!!  ::) I have changed the code to the following, it is writing the urls but is not changing when seen by a bot? Any ideas most welcome Thanks [code]<html> <head> <title>Test</title> </head> <body> <?php $botlist = array("alexa", "appie", "Ask Jeeves", "crawler", "FAST", "froogle", "Firefly", "girafabot", "Googlebot", "InfoSeek", "inktomi", "looksmart", "NationalDirectory", "rabaz", "Scooter", "Slurp", "Spade", "TECNOSEEK", "Teoma", "WebBug", "WebFindBot", "URL_Spider_SQL", "ZyBorg");                 function detectBrowser($agent) {                                     if (eregi("botlist", $agent)) {                                         $browser = "Bot";                       } else {                                         $browser = "Browser";                       }                                 return $browser;                 } ?> <?php $user_agent = $HTTP_SERVER_VARS["HTTP_USER_AGENT"]; $isBrowser = detectBrowser($user_agent); if ($isBrowser=="Bot") { echo '<a href="http://www.sitea.com">site a</a>'; } else { echo '<a href="http://www.siteb.com">site b</a>'; } ?> </body> </html>[/code]
  6. Well my knowledge of php is even poorer than first imagined! Im trying to do something simple but jsut cant get it to work and would really appreiciate some help. Im trying to detect whether the user agent is a robot and if it is to send it to one page, and if its not to send it to another. [code]<html> <head> <title>Test</title> </head> <body> <?php $botlist = array("alexa", "appie", "Ask Jeeves", "crawler", "FAST", "froogle", "Firefly", "girafabot", "Googlebot", "InfoSeek", "inktomi", "looksmart", "NationalDirectory", "rabaz", "Scooter", "Slurp", "Spade", "TECNOSEEK", "Teoma", "WebBug", "WebFindBot", "URL_Spider_SQL", "ZyBorg");                 function detectBrowser($agent) {                                     if (eregi("botlist", $agent)) {                                         $browser = "Bot";                       } else {                                         $browser = "Browser";                       }                                 return $browser;                 } ?> <?php $user_agent = $HTTP_SERVER_VARS["HTTP_USER_AGENT"]; $isBrowser = detectBrowser($user_agent); if ($isBrowser=="Bot") { echo "<a href='http://www.sitea.com">";} else { echo "<a href='http://www.siteb.com">"; } ?> </body> </html>[/code] But im not quite sure what im doing wrong? I dont want to redirect the user i just want the hyperlink to change Any ideas would be most appreciated. Thanks Alex
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.