Skip to main content
Participant
January 24, 2011
Answered

CS5 won't display php object property references correctly.

  • January 24, 2011
  • 1 reply
  • 585 views

All,

   I have some code that I know works, its a script I got from here:

http://www.evolt.org/node/60384

A short summary of the problem is illustrated through this code:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?

class Session{
     var $name = 'blah';

}

$sesh = new Session;

echo '<p>'.$sesh->name.'</p>';

?>
</body>
</html>

It seems that the page when viewed locally should display

blah

but instead I get

name.'

'; ?>

In fact, any time I use the '->' php feature in Dreamweaver this sort of thing happens.

I have xampp installed, created a site and local server for the particular project, and have used CS5 for numerous other projects without problems (I know the procedure for running php and mysql locally), although I have never used classes and the -> feature until now.

When I upload the script to my live webserver, it works fine. But, I would like to get to the bottom of this problem so that I can test more effectively on my own computer. I believe the problem lies either in Apache's or Dreamweaver's interpretation of '->'.

Any help would be greatly appreciated.

Thanks,

   Zach

This topic has been closed for replies.
Correct answer antares5

You're missing the "php" in the opening bracket - should be <?php

1 reply

antares5Correct answer
Inspiring
January 24, 2011

You're missing the "php" in the opening bracket - should be <?php

Participant
January 24, 2011

Thanks bud! I didn't even realize the code didn't have the correct opening tags.