Running PHP Script from OTRS

English! place to talk about development, programming and coding
Post Reply
Ultra
Znuny newbie
Posts: 3
Joined: 05 Apr 2012, 15:00
Znuny Version: 3.0.11
Real Name: Ultra

Running PHP Script from OTRS

Post by Ultra »

Hello,

is it possible to run php scripts from OTRS?

My goal is to implement a 5 star rating script on the public FAQ interface. I want that our customers should rate our FAQ articles without logging in the customer (customer.pl) interface.

I have found this smaple and now want to impelent it: http://sandbox.ronggur.com/2009/05/30/j ... -with-php/

Therefore I have modified the PublicFAQZoom.dtl with:

Code: Select all

			<ul class='star-rating'>
		      <li class="current-rating" id="current-rating"></li>
				<span id="ratelinks">
		    	    <li><a href="javascript:void(0)" title="1 star out of 5" class="one-star">1</a></li>
		    	    <li><a href="javascript:void(0)" title="2 stars out of 5" class="two-stars">2</a></li>
		    	    <li><a href="javascript:void(0)" title="3 stars out of 5" class="three-stars">3</a></li>
		    	    <li><a href="javascript:void(0)" title="4 stars out of 5" class="four-stars">4</a></li>
		    	    <li><a href="javascript:void(0)" title="5 stars out of 5" class="five-stars">5</a></li>
				</span>		
		    </ul>
and put the Java-Script starrating.js to Loader::Customer::CommonJS###000-Framework

I created than the update.php file and put it to the directory /opt/otrs-3.0.12/bin/cgi-bin

Now when I open an FAQ Article https://otrs-dev/otrs/public.pl?Action= ... m;ItemID=1 I get an error message: some error occured, please try again later but after klicking on OK button I can see the rating starts. See here: http://s14.directupload.net/file/d/2891 ... t3_png.htm

I looks like the error message comes from the java-script because it tries to update the Database by ecexuting an update.php script.

My Apache error log shows me:

Code: Select all

[Tue May 15 12:59:09 2012] [error] Unterminated <> operator at /opt/otrs/bin/cgi-bin/update.php line 1.\n
So the question is how can I execute the update.php script from Java or OTRS whatever???
OTRS version: 3.0.10
OS: Debian Linux
Web server: Apache2
DB: MySQL 5.1
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Running PHP Script from OTRS

Post by jojo »

there is already a rating option in FAQ....
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
Ultra
Znuny newbie
Posts: 3
Joined: 05 Apr 2012, 15:00
Znuny Version: 3.0.11
Real Name: Ultra

Re: Running PHP Script from OTRS

Post by Ultra »

jojo,

thank you, I know that. But the problem is that only registred customers could rate FAQ articles. I want to make it public for everyone.

In the meantime I have found the error. I have moved the update.php script to /opt/otrs-3.0.12/var/httpd/htdocs and the rating is working. The problem now is that I do not have a unique ID for each rating. That means that the same rating result is shown on each FAQ article page. I would like to use $QData{"ItemID"} as a qunique ID but I don't know how read this value from the Javascript. Can you help me please?
OTRS version: 3.0.10
OS: Debian Linux
Web server: Apache2
DB: MySQL 5.1
Post Reply