changing the value of a variable in an object through a butt
Posted: Sun Feb 09, 2003 4:08 am
Im kind of a newbie at this and i was hoping for some help.
Im working on a class that will spawn a module type of object around content by typing the following into the body of my main page.
<?php
$a = new module("n","title","lots and lots of content");
echo $a->printit();
?>
the code to the actual class is as follows
<?php /* Spawn Module */
class module {
var $minimized;
var $title = "";
var $body = "";
function module ($m,$t,$b) {
$this->minimized = $m;
$this->title = $t;
$this->body = $b;
}
function printit() {
if ($this->minimized == "y") {
html code and junk for the minimized object
}
if ($this->minimized == "n") {
html code and junk for the maximized object
}
}
}
I pasted that in so its kinda sloppy but what i need help with is in the
if ($this->minimized == "y") { part of it i have html that make up the window wnd stuf and within the html i have a image button that when you click it i want to tell the object that $this->minimized = n ;
so i can do the opposite in the html code of the if ($this->minimized == "n") { part of is so i can get a minimizeing and maxamizing action going on but im not sure how to tell the object in a image type of button that the value of $this->minimized has changed to eithier y or n.
i have found stuff on how to write and structure classes but nothing on changing the value of a variable in an object through a button or something.
anything would help
thanks...
Im working on a class that will spawn a module type of object around content by typing the following into the body of my main page.
<?php
$a = new module("n","title","lots and lots of content");
echo $a->printit();
?>
the code to the actual class is as follows
<?php /* Spawn Module */
class module {
var $minimized;
var $title = "";
var $body = "";
function module ($m,$t,$b) {
$this->minimized = $m;
$this->title = $t;
$this->body = $b;
}
function printit() {
if ($this->minimized == "y") {
html code and junk for the minimized object
}
if ($this->minimized == "n") {
html code and junk for the maximized object
}
}
}
I pasted that in so its kinda sloppy but what i need help with is in the
if ($this->minimized == "y") { part of it i have html that make up the window wnd stuf and within the html i have a image button that when you click it i want to tell the object that $this->minimized = n ;
so i can do the opposite in the html code of the if ($this->minimized == "n") { part of is so i can get a minimizeing and maxamizing action going on but im not sure how to tell the object in a image type of button that the value of $this->minimized has changed to eithier y or n.
i have found stuff on how to write and structure classes but nothing on changing the value of a variable in an object through a button or something.
anything would help
thanks...