Adding php to a block

Permalink
Hi there,

I am using a rss2html php script to make my RSS feeds searchable by the C5's default search engine.

In order to make it work I have tried two options:
1. Creating a single page. Then adding a php block (addon) and pasting the code. I get the following error. I checked the file view.php and saw anything suspicious.
Parse error: syntax error, unexpected T_STRING in /usr/home/jobs4librarians.com/web/packages/nd_php_package/blocks/nd_php/view.php(4) : eval()'d code on line 1


2. Adding HTML block with the script embedded in the html.
It just doesn't display the listings (Nothing happens).

However the script works perfectly. Here an example:
http://www.jobs4librarians.com/blocks/rss_reader.php...

Please some help!!!!

ggutierrez79
 
PauloCarvalhoDesign replied on at Permalink Reply
PauloCarvalhoDesign
If your adding php dont use html block, wotn work use this:
http://www.concrete5.org/marketplace/addons/simple-php-block/...
Or just copy the script and paste it where you want it on your page type.
ggutierrez79 replied on at Permalink Reply
ggutierrez79
Hi Paulo,

I am using the PHP block. However it doesn't work I get the error specified above.

Any idea why?
JohntheFish replied on at Permalink Reply
JohntheFish
That is a standard php error message for faulty syntax in your php code.

If the code parsed correctly before you added it to the php block, sometimes you may have to escape some quotes in order for it to work within the eval() that the php block uses.

Another solution to the same problem is to add your php code to a custom template for the html block. It won't be as easy to edit afterwards, but it does avoid the eval() and is an easy way to just get a bit of php into a view.
ggutierrez79 replied on at Permalink Reply
ggutierrez79
"may have to escape some quotes"?
Sorry I do not understand what you mean. Could you please explain it? Maybe I am not used to some terminology...Thanks for the translation!
PauloCarvalhoDesign replied on at Permalink Reply
PauloCarvalhoDesign
Misread your point 1 in you comment...