OOP in php
Posted: Fri Dec 16, 2005 4:14 am
patrikG | Please use
I try to do like this:
But it does not show me "lea" on the screen...
When I browse the source code i see:
<html>
<head><title> Login and password verification </title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>
<body>
<?
echo "lea";
?>
</body>
</html>
Please help!
Note: I need to set a php content there. "lea" is just a simple example.
patrikG | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I have problem with setting content in the following class:Code: Select all
<?php
class Page
{
var $content;
var $title;
function SetContent($newcontent)
{
$this->content=$newcontent;
}
function SetTitle($newtitle)
{
$this->title=$newtitle;
}
function DisplayTitle()
{
echo "<title> $this->title </title>";
}
function DisplayMeta()
{
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">";
}
function Display()
{
echo "<html>\n<head>";
$this->DisplayTitle();
$this->DisplayMeta();
echo "</head>\n<body>\n";
echo $this->content;
echo "</body>\n</html>";
}
}
?>Code: Select all
<?php
session_start();
require ("page.inc");
$log = new Page();
$log -> SetTitle("Login and password verification");
$log -> SetContent('
<?
echo "lea";
?>
');
$log -> Display();
?>When I browse the source code i see:
<html>
<head><title> Login and password verification </title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>
<body>
<?
echo "lea";
?>
</body>
</html>
Please help!
Note: I need to set a php content there. "lea" is just a simple example.
patrikG | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]