alexasigno Posted July 7, 2007 Share Posted July 7, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/58813-php-in-smarty-templates-using-php/ Share on other sites More sharing options...
alexasigno Posted August 10, 2007 Author Share Posted August 10, 2007 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/58813-php-in-smarty-templates-using-php/#findComment-320182 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.