Aug
25
Okay, so how will code look?
[geshi lang=php ln=y] //some code goes here
//I did a hard newline
//soft newline
public class myClass(){
private var $contents;
public function __construct(){
$this->contents = 'Hello World!';
}
public function __get(){
return $this->contents;
}
public function __toString(){
return $this->contents;
}
}
$classExample = new myClass;
$var = $classExample;
echo $var . "\n";
echo $classExample;
//the code above looks the same, and outputs the same, but calls two different methods within the class structure.[/geshi]
That's my first ever written PHP5 OOP class...ever. Amazing, isn't it? Be wary, I haven't debugged it.
Wooooooooo! Serendipity GeSHi Plugin extended class has been edited to remove "<br />" tags. I know I'll need to tweak it a bit so that it doesn't incorrectly match (and then subsequently remove) these tags elsewhere in the body.
So, now that I can show example code without worries (much) I can move on to fixing up the design a bit to the way I'd want it to look.
--edit-- Okay, well it looks like GeSHi, or some other plugin, uses stripslashes on output, so to get a forward slash, I have to use \\ (and to output two like I did here, I had to actually type out 4). When editing, it only shows one or two. Great... I have some more research to do.
[geshi lang=php ln=y] //some code goes here
//I did a hard newline
//soft newline
public class myClass(){
private var $contents;
public function __construct(){
$this->contents = 'Hello World!';
}
public function __get(){
return $this->contents;
}
public function __toString(){
return $this->contents;
}
}
$classExample = new myClass;
$var = $classExample;
echo $var . "\n";
echo $classExample;
//the code above looks the same, and outputs the same, but calls two different methods within the class structure.[/geshi]
That's my first ever written PHP5 OOP class...ever. Amazing, isn't it? Be wary, I haven't debugged it.
Wooooooooo! Serendipity GeSHi Plugin extended class has been edited to remove "<br />" tags. I know I'll need to tweak it a bit so that it doesn't incorrectly match (and then subsequently remove) these tags elsewhere in the body.
So, now that I can show example code without worries (much) I can move on to fixing up the design a bit to the way I'd want it to look.
--edit-- Okay, well it looks like GeSHi, or some other plugin, uses stripslashes on output, so to get a forward slash, I have to use \\ (and to output two like I did here, I had to actually type out 4). When editing, it only shows one or two. Great... I have some more research to do.


0 Trackbacks