Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-05-27 22:16:27

WizardS
New Member
Registered: 2006-02-17
Posts: 6

Problems with object oriented PHP code

I need some lines of PHP code in my articles to generate address lists.

I use this part of code:

<txp:php>include(dirname(FILE).’/arztdb/liste.class.php’);
$liste = new Liste();
$liste->bereiche = array (1,2);
$liste->fillValuesFromDB(‘’,‘plz,name’);
echo $liste->generateTable();

</txp:php>

But I get this error when calling the page:

Parse error: parse error, unexpected ‘&’ in /homepages/14/d84726115/htdocs/textpattern/publish/taghandlers.php(1731) : eval()’d code on line 3

Apparently, the “greater than” is translated before the PHP code is executed and therefore generates an error.

In other code examples in the forum I have seen that lots of people seem to be successful with the “=>” syntax in arrays, but the object oriented “->” does not seem to work?

Any suggestions?

Thanks a lot!

Simon

Offline

#2 2006-05-27 22:44:02

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Problems with object oriented PHP code

FAQ.


Alex

Offline

#3 2006-05-27 23:40:28

WizardS
New Member
Registered: 2006-02-17
Posts: 6

Re: Problems with object oriented PHP code

Thanks a lot. Did overlook it. Sorry. Does not help me much though. Since I pass variables, it is not too great using forms. Must try to avoid this stuff now.

Offline

#4 2006-05-28 01:52:04

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Problems with object oriented PHP code

Passing variables is still possible – just set globals first, and reference them explicitly from within the form. Similar to what’s done here, under Variable Scope.


Alex

Offline

Board footer

Powered by FluxBB