Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Trouble using PHP with Citydesk

I am trying to make PHP work with Citydesk.  It generally worked until I tried to embed cityscript into it. Now just as soon as I marked php files as target for magic name processing, I ran into problems - random php variables being flagged as incorrect cityscript syntax, the line number given with the offending text  goes crazy (line numbers given are like 1000 while the file is only 300 lines long.)

-----
Invalid keyword "zheaderarray" (\scriptlib\adodb\tohtml.inc.php:4064)
Invalid keyword "HTTP_SESSION_VARS" (\scriptlib\adodb\adodb-cryptsession.php:1003)
Invalid keyword "HTTP_SESSION_VARS" (\scriptlib\adodb\adodb-session.php:789)
An error occurred while publishing, so the site was not uploaded.
-------------

Anybody else who got this problem? Am I doing something wrong?

TIA,
  Sandip

Sandip Bhattacharya
Wednesday, October 22, 2003

One incorrect terminology used. I was not trying t o use cityscript,. I was just trying to use magic names in it.

Sandip Bhattacharya
Wednesday, October 22, 2003

Without seeing your page it's difficult to say what's wrong but I'd be fairly certain that you're using {$ $} in the page (or at least CityDesk thinks you are) so it's trying to parse what's inside thinking it's cityscript.

To get around this, follow this advice from the help:

http://www.fogcreek.com/CityDesk/2.0/help/Scripting_With_CityScript/fog0000000061.html

John C
Wednesday, October 22, 2003

To reproduce this:
1.Download http://cvs.raxnet.net/cgi-bin/viewcvs.cgi/cacti/lib/adodb/tohtml.inc.php 
.
2. save it as tohtml.php1
3. Configure citydesk to allow cityscript inside it.
4. Try to publish it.

- Sandip

Sandip Bhattacharya
Thursday, October 23, 2003

You obviously didn't read that link I pointed to. If you did you would have noticed that you have the following line:

$s .= "    <TH>{$zheaderarray[$i]}</TH>\n";


Which contains {$ which denotes cityscript to CityDesk.  As the article you didn't read explains, you replace that with {{$$}$ to produce:

$s .= "    <TH>{{$$}$zheaderarray[$i]}</TH>\n";

See?

John C
Thursday, October 23, 2003

Ok. Mea culpa. Missed that one. BTW, I DID read that link, ... way before you referred it  though .. in the citydesk help file on my system.

At the resolution of the text that appears in my browser, a {$ and an ($ (stuff which most php sources comprise of), looks pretty much the same., so I missed that one instance of {$ in the text. Sorry for the trouble.

Ofcourse, the fact that citydesk didn't bother to tell me correctly which line it is finding trouble with, didn't help me much either.

However, it still doesn't solve my problems. I cant go on changing all the PHP libraries to suit CityDesk, if I have to keep up with upgrades! All I wanted to do was to get magic names substituted.  So are magic names considered cityscript too?

Sandip Bhattacharya
Thursday, October 23, 2003

What's so hard about changing '{$' to '{{$$}$' in each PHP file? You're already in there editing them to insert your Magic Names, so just do a Search And Replace to fix up the '{$' bits.

Darren Collins
Thursday, October 23, 2003

Ok ... i might be doing things oddly here ... I have added PHP libraries to citydesk too ... apart from my own php code which uses them ... now if I have a few hundredd lines of my own code in my custom files ... there would be thousands of line of code in the libraries ...I am only using magic names in my own code ...

I can change them tags in my code ... but changing the libraries is a different ballgame altogether ...

Anyway ... I will go ahead with the old fashioned way of uploading PHP libraries separately .. and only using "cleaned" PHP code in citydesk  otherwise ...

Thanks a lot for your help anyway.

Sandip Bhattacharya
Thursday, October 23, 2003

*  Recent Topics

*  Fog Creek Home