Include PHP code into Category Description (HTML)

I would like to place an include of PHP code into the Category Description so that I can execute a PHP routine to display RSS feeds



This code does not work:


$XMLFILE = "http://news.search.yahoo.com/news/rss?p=real%20estate&ei=UTF%2D8&datesort=1";
$TEMPLATE = "http://www.MyWebsite.com/sample-template.html";
$MAXITEMS = "10";
include("rss2html.php");
?>

I have tried to replace with {/php} but still no go.

alternatively I could use Server Side Include, but that doesn't work either.

I can do this using iFrames but prefer the PHP include.

Anyone have any suggestions?

Thanks!

to include php code into tpl-files use this syntax:



{php}



{/php}



between these tags you can script php.

BUT remember: it can be read client-side!, so dont use

any passwords or so in those tags!

NWSCO thanks for your reply, I appreciate it.



In order to accomplish what I am looking to do I need to be able to enter this into the Description field in for a category or subcategory or even the main page. This will allow me to vary the RSS Feed by category or subcategory and it will also allow me to modify the Feed search parameters very easily.



Any thoughts on if this is possible?



Thanks!

have a look on the smarty forum for that i’d say.

[url]Search Results for "forums" | Smarty



have you tried a normal smarty include outside of php tags?

Hi t3446jt



Try this one, hope it works



{php} require_once("rss2htm.php"); {/php}

that would be odd, since require is similar except for error-handling afaik…

AFAIK smarty does not work in admin back-end ?

yes it does.

but maybe i get your opinion wrong and you can explain:

why wouldnt it work? i’ve written loads of stuff back there lol.



btw t3446jt, here is your answer i think:

[url]http://www.phpfreaks.com/smarty_manual/page/language.function.include.php.html[/url]

mind that it is deprecated, so it might not work in future versions (2010?)

It’s not my personal opinion rather my experience that it doesn’t work.



Because if I type {$lang.features} in “Organize home page” you will see that it spits out the text “{$lang.features}” on the frontpage. Not converted.



Same goes for categories and product pages.



The original poster said: "I would like to place an include of PHP code into the Category Description "



Notice that he does not mean .tpl files but rather the editboxes in the admin back-end. Where in my experience smarty does not work. And I wish it did.

ok gotcha.



well, anyways, back on the php-include in smarty:

{include_php} is the tag for this, see my link.

i hope it helps.

Thanks for all the suggestions. Looks like it will be Iframes then.



I appreciate the help.

Hey! I was just thinking…I am somewhat of a rookie to Smarty and PHP… would it be possible to place my routine;


$XMLFILE = "http://news.search.yahoo.com/news/rss?p=real%20estate&ei=UTF%2D8&datesort=1";
$TEMPLATE = "http://www.MyWebsite.com/sample-template.html";
$MAXITEMS = "10";
include("rss2html.php");
?>

into the .TPL and then somehow assign $XMLFILE URL value from inside the EDITBOX in the AdminBackend? The $XMLFILE URL is really the only thing that I want to change between product categories and sub-categories.

You can’t do anything coding wise in the back-end because CS-Cart has disabled that option.



So, no.

[quote name=‘Zyles’]You can’t do anything coding wise in the back-end because CS-Cart has disabled that option.



So, no.[/quote]



LOL



You can create a new database fields, add this to the backend of CS cart

however you would also need to hack away at the queries to pull this information, then via the php files assign the var to smarty.



Next in smarty pull the var into your xml…



So yeah possible, but would be easier if they worked out how to allow the use of smarty etc.