Classes and PHP
Great, now what to we do with it? I'm glad you asked. We need to create a few more functions within Style to actually accomplish anything. The first thing I'd like to do is set up my page body so I did this:
function Body() {
PRINT "
Magento是一套专业开源的PHP电子商务系统。Magento设计得非常灵活,具有模块化架构体系和丰富的功能。易于与第三方应用系统无缝集成。Magento开源网店系统的特点主要分以下几大类,网站管理促销和工具国际化支持SEO搜索引擎优化结账方式运输快递支付方式客户服务用户帐户目录管理目录浏览产品展示分析和报表Magento 1.6 主要包含以下新特性:•持久性购物 - 为不同的
"TEXT=\"$this->text\" ".
"LINK=\"$this->link\" VLINK=\"$this->vlink\" ".
"ALINK=\"$this->alink\"> "FACE=\"$this->face\" SIZE=$this->size>\n";
}
?>
This sets up the page body for us. It also illustrates a new variable "$this." When used inside of a class function it lets the interpreter know we are referring to a variable of THIS instance. In other words, it's assigned the value of the name of the instance in the calling line (e.g. $this would be == $Basic when $Basic->Body() is the calling statement.) Also, notice we are doing something here that's much simpler than is possible in regular functions. We're referring to variables that were not passed to the function. Remember, all functions and variables of an instance are available to all functions of that instance. To do this with regular functions you'd have to set up several global arrays.
Try this in your php script (assuming you've included the Style class, created the style objects above and sent the and tags):
Body(); ?>
Now, we're ready to print something out. We could do it the old fashioned way, but I'm going to do something different... that's right another function:
function TextOut($message=" ") {
PRINT "face\" ".
"SIZE=$this->size COLOR=\"$this-> ".
"text\">$message\n";
}
?>










