Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Output on OOP
September 26, 2013 04:14PM
Hi everyone

Can you help me to understand as to what is expected in step4 in portfolio page, for me I can produce output on the same page but on another page, how exactly can I do that?
avatar Re: Output on OOP
September 26, 2013 04:33PM
You don't have to output the data on another page.

You can save the class (Car) in a separate file e.g. class.php
Then include the file into the page you want to use to display the data manipulated by the class.
Here is the code to include the file if you have saved it on the same folder:

Language: PHP
<?php include ("class.php"); ?>


After including the file, you can then be able to use the functions/methods and properties/variables of that class on the
page you want to use to display the data.
avatar Re: Output on OOP
September 26, 2013 04:40PM
"require" would be better than "include" - the file would clearly be essential to the proper functioning of the page.

"require_once" is probably even better.
Re: Output on OOP
September 26, 2013 05:05PM
thanks

do you think its fine using steps as the name of my pages? because we are not told how to name our pages
avatar Re: Output on OOP
September 26, 2013 05:45PM
The page names are given, what you mean to say is that we are not told what names to use as links to the pages.

OOP_properties.php is the page

OOP_properties is the page name

<a href="OOP_properties.php">OOP_properties</a> is a link to the above mentioned page (see code example below)

Well using steps as the links would be inappropriate because step 1 to step 4 have to be done on the same page.
We had a discussion about the names to be used as links in one of my posts and we concluded that the names
of pages will be used as the link names.e.g. OOP_properties would be used for OOP_properties.php

Therefore the link code will be something like:

Language: PHP
<?php echo ';<a href="OOP_properties.php">OOP_properties</a>';; ?>
avatar
Mac
Re: Output on OOP
September 27, 2013 08:59AM
From the first tut there is always a link between the link name and the page name. Therefore OOP_properties.php is linked by OOP_properties, and so forth.
Re: Output on OOP
October 02, 2013 09:27AM
Thanks

I wrongly thought each step should be regarded as a page
Sorry, only registered users may post in this forum.

Click here to login