Edward
Members-
Posts
1115 -
Joined
-
Last visited
-
Days Won
27
Everything posted by Edward
-
Here is the Yii BootStrap code <?php // change the following paths if necessary $yii=dirname(__FILE__).'/../../framework/yii.php'; $config=dirname(__FILE__).'/protected/config/main.php'; // remove the following lines when in production mode defined('YII_DEBUG') or define('YII_DEBUG',true); // specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); require_once($yii); Yii::createWebApplication($config)->run(); I am confused as to where to find the run method in the YiiBase.php class i couldn't see it but can find the createWebApplication method with no problems.
-
No bother we will have to work together on this its tough, i got a question I'm adding now.
-
I have a similar setup as you as i am using XAMPP, i have just left my protected folder for now in the root directory because if i put my framework below the root direct e.g in C:\xampp\ i would have to change my project setup in my Dreamweaver IDE and i would have to do more clicking around than usual to get into certain locations, i think unnecessary for a localhost. It would seem to me though that the protected folder should not be renamed in the case that it could be used by something in the site we are unaware of and could through errors later on. I will move the protected folder and update my bootstrap on the live server. I found something here on the YiiFramework forum, apparently so the protected folder could be renamed. http://www.yiiframework.com/forum/index.php/topic/33846-public-folder/
-
Those magic methods that Antonio was mentioning is something i would like to have seen a bit more of in the book. There are get and set magic methods, actually i was reading in the Yii Cookbook how Yii uses these in CComponent which you extend your class from and then you can omit the get and set when getting or setting properties. Anyway this is off the subject of this thread, so back to the thread.
-
What i was referring to here was PHP on the higher level, for instance PHP is always upgraded for improvements, as well as bug fixes, and possible other things. But the point being that there are most probably bugs that are effecting the level of security of our websites. So i was meaning we could be writing our code correctly following all the correct security procedures but something on the higher level is our security hole. You get what I am saying? This kind of gap is something that can only be fixed by its makers.
-
What I like about MVC is the benefit of just been able to completely work on code logic first of all. Then later its just a case of the views files which present the standard CSS and HTML to be passed the data via the controller. It means you can work on the look of the site last of all and not getting it all mixed up in the logic which can be difficult to change after its done.
-
I understand where you are coming from but the way I got around some of this problem is building my own MVC, try following along with some of these tutorials http://jream.com/lea...videos/php-oop. I done them but rewrote some of the code as i was following them as there was some bugs, but it gives more of an idea of how Yii and others MVC frameworks like Codeignitor work. Now the way i see these objects is loading up in a hierarchy but all loading one before on another on a straight line if you like to look at it that way, i guess I could rename this the procedural line. But i do see where you are coming from kind of like "What objects load up first?" or "What do these objects do". Most of those classes in a way do speak for themselves but there are the odd load i am also unsure of how to implement. I am actually planning on building my own classes for my practice site which is procedural now just to get some more class practice example. I didn't read the old PHP Advanced book as i waited for the new one its changed a lot since last edition, Larry tailored the book as he knew people would continue onto a framework after. So effort was put in to emphasize on these framework techniques. There is a design patterns chapters, its really well explained makes these really easy unlike some books. There was also an explanation of Unified Modeling Language (UML) which was useful to comprehend those Class diagrams. If you have the time it would be worth getting most of the main OOP stuff and examples could be covered over a month i guess. I do have confidence with Yii though as making the OOP MVC myself earlier made me realize that I would just be building a pile of similar untested code. Its smarter to use the framework. And security wise you can see that level of security yourself. All the Classes are already there just to call to run there static methods for striping tags, encoding, encrypting etc. As far as i see most of the security taught in books is all the same, i think the server, host, PHP etc may be the problem not the actual code. By the way i didn't do any Yii, i just worked on my practice site a bit and done the JS book. I haven't worked on my practice site for about a month or more now. I intend to get the new OOP stuff in for practice like i said.
-
I really never thought of standing up doing work before, i did some research online and found this article. http://ergonomics.ab...anding-Desk.htm "If you sit for more than 23 hours a week you are 64% more likely to die from heart disease." Hmm this is quite worrying.
-
Sorry to interrupt, but good to see you back on here Jonathon. I have almost come to the end of my reading on the PHP Advanced book, i have learned a lot, glad i listen to you and took two steps back to read Larry's books. Done JS book also. How did your last Yii project go, did work on it up till now or did you wait until Larry's Yii book came out before proceeding further with it. I did some practice building my own OOP MVC and it worked but there is no way i will be building everything alone I don't have the time, so i will be going with Yii for sure. Looking forward to reading your Yii post. J This is a good post very informative. These posts are very good for getting started with Yii. A good group of people have helped put these together. That's why Yii is a good framework to learn. It has a strong structure a good base better than other frameworks available. Right now Yii is the number 1 PHP framework because it is the easiest to use. Because it was built by a Chinese guy. It is the best PHP framework so far because of its ease of use and flibility.
-
I like to use single quotes in my echo statements when printing out only HTML code. If I have some php variables mixed in with the html i will use the double quotes so variable values are printed rather than the literal variables, then also escape double quotes in the HTML quote so it is not messed up. I am like you margaux also i do tend to add the php tags in and out of code, but also frequently use the above method, it really depends on the situation. If you are using an MVC and you have your views script the php tabs method works great. HEREDOC is cool but for me it is a little ugly, may come to use it though.
-
Your office is nice and tidy but what is the benefit to standing as to sitting down? To burn extra calories?
-
Chapter 4: Form_Functions.Inc.Php
Edward replied to armlocker's topic in Effortless E-Commerce with PHP and MySQL
It prevents the headers already sent php error message that's why they are omitted. Zend recommend leaving them out on included files e.g functions and classes. -
I was just checking on your Facebook page and I saw your office, http://www.facebook....&type=3 http://www.facebook....&type=3 Which of these pictures is the new look? Is this your home office? Edit: A I see now on facebook timeline the first link is your new office, it's nice. Its like behind in an internet cafe you must be quite high up in that chair. I have something like in the 2nd image Ive got that same desk chair but i always find i am leaning forward in it and never resting back against its back. So i guess that's why you have the high chair as its more back supporting?
-
Really wish I could help you on this but unfortunately I can't. I have done the first half of the book but still have to work through Coffee shop, will be starting on it within the next two weeks. That's one hell of a query, it would be hard for someone to understand without having worked through the site for them-self i think but hey may be i will be proven wrong.
-
The more ugly it looks the more impressed your Girlfriend will be that you can comprehend such complicated code.
-
I finished of the JS book which was awesome it makes JS easy as it was not from other authors. But i would just like to say i am really impressed with the PHP Advanced OOP book, this book is definitely better put together than the David Powers OOP Solutions book. I can also see how your are crafting this book towards using the Yii framework, you have many similar situations to Yii. The Interface chapter for example and also the earlier MVC chap where you routed all the pages through index.php using MOD REWRITE. This is definitely good, David Powers lacked these experience building examples. Sadly no traits or namespaces in Yii Version 1, may have to wait for the 2nd, those are useful. Actually i guess if my host has PHP 5.3, it won't matter i could still use them even though i possibly lack some of the new Yii functionality. I guess another way of looking at this is people have been surviving for years now making millions to billions of dollars without traits and namespaces so do we really need them!!
-
Sql Tables Chpt 7 Problem With Orders Table
Edward replied to e-mazed's topic in Effortless E-Commerce with PHP and MySQL
Try removing the backticks from the SQL code then run it through phpmyadmin. -
Access All Objects Of A Class
Edward replied to bijan's topic in PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
It should be a member of the base class. Then you can access the base class array to extract which value you need. -
I emailed PeachPit yesterday regarding the book code and received an email from them today, i thought their zero in the code was Q, so it was mistake. I have to say after reading the YiiBook on my mobile device I have come to love the eBooks, its just awesome being somewhere and being able to pull the notes up without carrying around the big book. It also helps you to keep what you are reading private which i prefer. Well now i have that on my mobile i should be able to better my skills for helping members around here if i can get to a thread before anyone else does. What about PHP and MySQL for Dynamic Web Sites forth edition would there be a chance Larry you can email me a eBook pdf version of that, i do have the book here.
-
Yeah i know i should plan out for real classes, its just i had limited time earlier so i just came up with the idea and just tried to see what i could hack together in the time i had. Yeah those abstract methods in life class i can see are not correct those could of been added to the child classes. The whole code actually needs some good modular separation but it was just for fun and so we can discuss. So for our real sites we can have something like a generic abstract user class then possibly extend to make a member class and extend also to make another admin class.
-
I got some idea after reading the abstract classes example in the book that i would create a Life abstract class and extend it to other life forms. I extended Humans and Alien Mothers from Prometheus as they were genetically engineered by them. But it seems that life as it is comes with the same attributes as from the base abstract class has been inherited by the humans even though Prometheus may have not wanted them to become so smart. So my guess is that is why Prometheus wanted to destroy the human race as they got a bit too smart!! There was something that i wanted to do in the Prometheus class below, well in the createHuman() method it would of been nice to have been able to create new classes of Human when this method was run but as far as i know Inner PHP classes are not possible in PHP but are in Java. This also made me think of object recursion as we do have function recursion when a function calls itself. Well i hope you like this fun example, i thought it would be simple to start of with but it started getting complicated, i have also realized that some of the methods should of been better prepared up the tree as in the human class they are inheriting abilities that should only of been possessed by Prometheus. So even though i made some mistakes below i have learned something from this example. <?php // A generic base abstract class for the existance of life. An abstract class can't be instantiated but can be extended. // Some of you might argue that the abstract class for this situation would be God but i wanted to keep things simple. abstract class Life { protected $name; protected $lifeFormType; protected $occupation; abstract public function eat(); abstract public function rest(); abstract public function learn(); abstract public function create(); abstract public function play(); abstract public function getLifeFormStats(); } // I am assuming in this example that Prometheus is the first type of life form in our universe class Prometheus extends Life { private static $_prometheus_life_counter = 0; // Constructor: function __construct($name, $occupation) { // Store the life form statistics $this->name = $name; $this->occupation = $occupation; $this->lifeFormType = get_class(); self::$_prometheus_life_counter++; } // End of constructor. public function getLifeFormStats() { // Build a string of life form stats to be returned by this function echo "The " . $this->lifeFormType . "'s name is " . $this->name . " its occupation is to " . $this->occupation . "."; } public function eat() { echo "A " . $this->lifeFormType . " named " . $this->name . " is enjoying eating his Granite Crunches."; } public function learn() { echo "A " . $this->lifeFormType . " named " . $this->name . " is learning how to build new space ships and create intelligent life forms."; } public function create() { echo "A " . $this->lifeFormType . " named " . $this->name . " is creating a new space ship."; } public function createHuman() { echo "A " . $this->lifeFormType . " named " . $this->name . " is creating a new human clone"; } public function createAlienMother() { echo "A " . $this->lifeFormType . " named " . $this->name . " is creating a new Alien Mother to lay more Face Hugger Eggs"; } public function play() { echo "A " . $this->lifeFormType . " named " . $this->name . " is playing the game \"Holographic Lazer Rock\" on his new iHolo4p"; } public function getTotalPrometheusLifeForms () { return self::$_prometheus_life_counter; } function __destruct() { self::$_prometheus_life_counter--; } } class Human extends Prometheus { private static $_human_life_counter = 0; function __construct($name, $occupation) { // Store the life form statistics $this->name = $name; $this->occupation = $occupation; $this->lifeFormType = get_class(); self::$_human_life_counter++; } // End of constructor. public function eat() { echo "A " . $this->lifeFormType . " named " . $this->name . " is eating."; } public function learn() { echo "A " . $this->lifeFormType . " named " . $this->name . " is learning."; } public function create() { echo "A " . $this->lifeFormType . " named " . $this->name . " is creating houses, roads and schools"; } public function createClone() { echo "A " . $this->lifeFormType . " named " . $this->name . " is cloning sheep, humans and other animals"; } public function play() { echo "A " . $this->lifeFormType . " named " . $this->name . " is playing the game \"Holographic Lazer Rock\" on his new iHolo4p"; } public function getTotalHumanLifeForms () { return self::$_human_life_counter; } function __destruct() { self::$_human_life_counter--; } } class AlienMother extends Prometheus { private static $_alien_mother_life_counter = 0; function __construct($name, $occupation) { // Store the life form statistics $this->name = $name; $this->occupation = $occupation; $this->lifeFormType = get_class(); self::$_alien_mother_life_counter++; } // End of constructor. // I will not override or add new methods here as this is for example purposes only. public function getTotalAlienMotherLifeForms () { return self::$_alien_mother_life_counter; } function __destruct() { self::$_alien_mother_life_counter--; } } class FaceHugger extends AlienMother { private static $_face_hugger_life_counter = 0; function __construct($name, $occupation) { // Store the life form statistics $this->name = $name; $this->occupation = $occupation; $this->lifeFormType = get_class(); self::$_face_hugger_life_counter++; } // End of constructor. // I will not override or add new methods here as this is for example purposes only. public function getTotalAlienMotherLifeForms () { return self::$_face_hugger_life_counter; } function __destruct() { self::$_face_hugger_life_counter--; } }