473,388 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

help please

new to this and me and classes have never mixed well, im getting no errors
but the only thing displaying is the copyright at the bottom of the page

Anyone tell me whats wrong?
Home.php_____________________
<?php
require('includes/page.inc');
$homepage = new page();

$homepage ->SetContent('<table width="95%" height="239" border="0"
align="center" cellpadding="0" cellspacing="0" >\n
<tr>\n<td width="120" height="69" bgcolor="#99CC00"
align="center">jhg </td>\n <td>this was inherited</td>\n</tr>
</table>'
);

$homepage->Display();
?>
Page.inc_______________________

<?php
//page class
class page
{
var $content;
var $title ='childhood memories';
var $keywords='childhood memories, peoples childhood of days gone by';
// class functions
function SetContent($newcontent)
{
$this->content = $newcontent;
}

function SetTitle($newtitle)
{
$this->title = $newtitle;
}

function SetKeywords($newkeywords)
{
$this->keywords = $newkeywords;
}

function DisplayHeader()
{
?>
<table width="95%" height="87" border="0" align="center" cellpadding="0"
cellspacing="0" >
<tr bgcolor="#99CC00">
<td height="87">&nbsp;</td>
<td width="745" height="87" bgcolor="#99CC00">&nbsp;</td>
</tr>
</table>
<?php
}
function display()
{
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\">\n<html>\n<head>";
$this->DisplayTitle();
$this->DisplayKeywords();
$this->DisplayStyles();
echo "</head>\n<body\n";
$this->DisplayHeader();
$this->content;
echo "<center>&copy;2004 Jarrowonline</center>";
echo "</body>\n</html>";
}

function DisplayTitle()
{
echo'<title> $this->$title</title>';
}

function DisplayKeywords()
{

echo "<META name=\"keywords\" content=\"$this->keywords\">";
}

function DisplayStyles()
{
echo '<link href=\"css/style.css\" rel=\"stylesheet\" type=\"text/css\">';
}
function IsURLCurrentpage()
{
if(strpos($GLOBALS['SCRIPT_NAME'],$url)==false)
{
return false;
}
else
{
return true;
}
}
}
?>
____________________________________

TIA
Jul 17 '05 #1
2 1684
Andy wrote:
new to this and me and classes have never mixed well, im getting no
errors but the only thing displaying is the copyright at the bottom
of the page

Add a new method DisplayContent which looks like this:

function DisplayContent() {
print $this->content;
}

Then replace:

function display() {
...
$this->content;
...
}

with:

function display() {
....
$this->DisplayContent();
....
}
function IsURLCurrentpage()
{
if(strpos($GLOBALS['SCRIPT_NAME'],$url)==false)
{
return false;
}
else
{
return true;
}
}


This can be written as follows (which is shorter):

function IsURLCurrentpage() {
return strpos($GLOBALS['SCRIPT_NAME'], $url) !== false;
}

(Also notice the double equal signs, which ensure that 0 isn't validated as
false)
JW

Jul 17 '05 #2
Janwillem Borleffs wrote:
Andy wrote:
new to this and me and classes have never mixed well, im getting no
errors but the only thing displaying is the copyright at the bottom
of the page


Also, replace the DisplayTitle function with following:

function DisplayTitle() {
echo "<title>$this->title</title>";
}

In the original function, you are using single quotes, which causes
$this->title not to be parsed but to be taken literal and printed as such.
JW

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
1
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
0
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
12
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem ...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
17
by: JT | last post by:
Help me the following C++ question: Write a program to help a local bookshop automate its billing system. The program should do the following: (a)Let the user enter the ISBN, the system will...
7
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
2
by: =?Utf-8?B?U2NvdHRSYWREZXY=?= | last post by:
I'm creating a doc project for my c# program. I've done this before but this time sonething is wrong. I build my doc project and is succeeds but when I open the help file, there is no documentation...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.