0

hi Friends
i have problam withe oop
i have class :

class create
{	
function CreateDiv($persian,$author)
{

$div="<div align=\"right\" dir=\"rtl\">"
. "<p style=\"font: 12px Tahoma; direction: rtl; text-align: right; line-height: 20px;\">"
. "test datebase"

."<font color=\"#0066FF\">$author</font> ".$persian->date('compelete')."<br>"
."</div>";
return (string) $div;
}

}

and sample page

<!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>Untitled Document</title>
</head>

<body>
<?php
include('persian_date.class.php');
include('Create_div.php');
$persian=new persian_date();
$author="Coward";
$test=new Create();
$test->CreateDiv($persian,$author);
echo $test;
?>
</body>
</html>

and error

Catchable fatal error: Object of class create could not be converted to string in D:\xampplite\htdocs\web me\create div\sample.php on line 16

and thx ;)

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Coward
0

:ooh:

$test1=$test->CreateDiv($persian,$author);
echo $test1;

:P

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.