[PHP] unexpected T_STRING parse error

2006-10-10 Thread Ilaria De Marinis

Hi list,
I got a php error in my apache log:

PHP Parse error:  parse error, unexpected T_STRING in 
/var/www/html/dummy/typo3conf/ext/direct_mail/locallang_tca.xml on line 1


This is line 1 of locallang_tca.xml file
?xml version=1.0 encoding=utf-8 standalone=yes ?

I try to switch short_open_tag to off in php.ini, but I got a bad page 
visualization.

In fact it's visible also source code while displaying pages.

Any ideas?
Thank in advance

Ilaria

--

De Marinis Ilaria
Settore Automazione Biblioteche
Phone: +3906-44486052
CASPUR - Via dei Tizii ,6b - 00185 Roma
e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] unexpected T_STRING parse error

2006-10-10 Thread Ilaria De Marinis

It's impossible for me to make this change.

xml files are packaged in external modules. I can't manipulate them!

Penthexquadium wrote:


On Tue, 10 Oct 2006 09:18:18 +0200, Ilaria De Marinis [EMAIL PROTECTED] wrote:
 


Hi list,
I got a php error in my apache log:

PHP Parse error:  parse error, unexpected T_STRING in 
/var/www/html/dummy/typo3conf/ext/direct_mail/locallang_tca.xml on line 1


This is line 1 of locallang_tca.xml file
?xml version=1.0 encoding=utf-8 standalone=yes ?

I try to switch short_open_tag to off in php.ini, but I got a bad page 
visualization.

In fact it's visible also source code while displaying pages.

Any ideas?
Thank in advance

Ilaria

--

De Marinis Ilaria
Settore Automazione Biblioteche
Phone: +3906-44486052
CASPUR - Via dei Tizii ,6b - 00185 Roma
e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   



?php
echo '' . '?xml version=1.0 encoding=utf-8 standalone=yes ?';
// ...
?

--
Sorry for my poor English.

 



--

De Marinis Ilaria
Settore Automazione Biblioteche
Phone: +3906-44486052
CASPUR - Via dei Tizii ,6b - 00185 Roma
e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ereg_replace with unser defined function?

2006-10-09 Thread Ilaria De Marinis

Hi Frank,
I think preg_replace_callback is a good solution for you.

If you don't want to use it, you can construct two arrays defining 
matches and replacements.


For example:
$matches
[230]
[120]
[340]

$replacements
[9.1]
[replace2]
[replace3]



After you stored matches in $matches using regular expression like 
yours,/preg_match_all 
http://it.php.net/manual/en/function.preg-split.php/ 
(([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?)(mm), $string, 
$matches, PREG_SET_ORDER)


you can define $replacements by this way:
for(int =0; icount($matches); i++){
   $replacements[$i]=round((substr($matches[$i][0], 0, 
3))*0.039370079),1); //take the last part of match with no digits, I 
don't know if there are sure 3 digits

}

for(int i=0; icount($matches); i++){
   preg_replace($string, $matches[$i][0], $replacement[$i].in);
}

hope to help you

Ilaria

Frank Arensmeier wrote:


Hello all.

Is it possible to have a user defined function for the replacement  
within an ereg_replace (like preg_replace_callback)? I am working on  
a script that converts html pages with metric data into imperial  
data. My script takes text strings containing one or more instances  
of e.g. 123 mm, 321 mm, 123 kg, 123 cm2 and so on. The script  
searches the string with a pattern like:

([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?)(mm)

When the script finds an instance, it stores the matches into an  
array - ereg ( $pattern, $textstring, $matches )


The replacement (for mm) looks like:
round ( ( $matches[1] * 0.039370079 ), 1 ) . $matches[2]  . in

Everything is working great accept when the string contains more than  
one instance for example of the metric unit mm. In that case, all  
instances of xy mm will be replaced with the first occurrence.


So, a text like:

The product is 230 mm tall, 120 mm thick and 340 mm wide will  
output as The product is 9.1 in tall, 9.1 in thick and 9.1 in wide  
- because the replacement string is based / calculated on the first  
occurrence 230 mm.


Alternatively, is there a way to limit ereg_replace to only replace  
one instance at a time?


Hopefully I am not too confusing...

regards,

/frank

ps. of course I have searched the manual and asked Google - no luck ds.




--

De Marinis Ilaria
Settore Automazione Biblioteche
Phone: +3906-44486052
CASPUR - Via dei Tizii ,6b - 00185 Roma
e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php