Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP Namespaces in Dreamweaver?

New Here ,
Apr 21, 2010 Apr 21, 2010

HI I was wondering if Dreamweaver supports PHP namespaces?  I've tested the following code in Dreamweaver CS4 it tells me I have an error in my code (even though it executes flawlessly on the server).

person.php

<?php
namespace pandemicode;

class Person {
          public $name;
          public $age;
          public $height;
          public $weight;
          
          public function __construct($n, $a, $h, $w) {
               $this->name = $n;
               $this->age = $a;
               $this->height = $h;
               $this->weight = $w;
               print "Creating " . $this->name . "\n";
          }
          
          public function __toString() {
               return "name: " . $this->name . "\nage: " . $this->age . "\nheight: " . $this->height . "\nweight: " + $this->weight;
          }
          
          public function __destruct() {
               print "Destroying " . $this->name . "\n";
          }
}
?>

index.php

<?php
     require_once("src/com/pandemicode/person.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>SPRY Test</title>
    </head>
    <body>
         <?php
               $obj = new pandemicode\Person("Mike", 28, "6'0\"", "180lbs");
               print $obj->age;          
          ?>
    </body>
</html>

Anyone run into issues using namespaces in PHP?

Thanks!

TOPICS
Server side applications
747
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 23, 2010 Apr 23, 2010
LATEST

Hi

CS4 does not recognize namespaces.

PZ

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines