Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

p4pLook.php on a previous question

https://www.experts-exchange.com/questions/28424591/do-you-personally-use-reflection-class-Is-this-something-I-need-to-learn.html?anchorAnswerId=40039576#a40039576

I closed the question as the last comment was written so I did not get to ask about code

when I saved file as p4pLook.php
loops and does not run

<?php include 'p4pLook.php';
$p4obj = new p4pLook('hilight',216,'kowork');?><!doctype html>
<html lang="en"><head><title>JQuery Ajax for PHP</title><link rel="stylesheet" type="text/css" href="p4p.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<script src="p4p.js"></script>
<?php $p4obj->doHead('Products on Sale',3); ?>
<div id="mid"><center>
<?php $p4obj->doBlu('intro531.txt',true); 
$p4obj->doBar();$p4obj->doOrngCor('Specials!', 'ox1', 'specials1.txt');
$p4obj->doBar();$p4obj->doProduct('ID-sale448', 'ox2',580);
$p4obj->setCode('fort5');
 ?>
</center></div>
<?php $p4obj->doFoot('obsto42.txt'); ?>
<script>/* <![CDATA[ */
menu1=getDom("m1");
var mHgt=menu1.offsetHeight-12;
var aNum = menu1.getElementsByTagName("a");
for(var i=0;i< aNum.length;i++) {aNum[i].onclick=nomenu;}
aNum[aNum.length-1].style.margin="0";
/* ]]> */</script>
</body></html>

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

This jumble of code is incomprehensible.  And I'm not sure I could understand it even if we had the class definitions!  Can you please just tell us in plain language what you're trying to achieve?
Avatar of Marco Gasi
When Slick812 will come back, he will explain well for sure.
Personally, I think he only gave an example about how the OOP can decrease the amount of code one has to write to achieve a specific task. In this case, using a class defined in the file p4pLook.php (@rgb192, have you the original file?), Slick812 builds a whole page with all contents. And passing the right parameteres, he can use the same class to output a virtually infinite number of pages.

So the p4pLook example is only an example: I don't think you have to make it work but simply look at the structure of the given file tos ee how the use of a class helps you to write less code to ouptu a whole web page.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

<?php
$p4obj = new p4pLook('hilight',216,'kowork');
$p4obj->doHead('Products on Sale',3);
$p4obj->doBlu('intro531.txt',true); 
$p4obj->doBar();
$p4obj->doOrngCor('Specials!', 'ox1', 'specials1.txt');
$p4obj->doBar();
$p4obj->doProduct('ID-sale448', 'ox2',580);
$p4obj->setCode('fort5');
$p4obj->doFoot('obsto42.txt');

Open in new window


but on nearly every web page in this site I can use a single Class file p4pLook.php and 6 or seven methods from it to produce many different use and functioning web pages, To say that The use of Object Oriented code has made that possible
Avatar of rgb192

ASKER

thanks

more code less writing.
@rgb192: I think I provided the correct answer here