Jump to content

Pudgemeister

Members
  • Posts

    94
  • Joined

  • Last visited

About Pudgemeister

  • Birthday 09/12/1989

Contact Methods

Profile Information

  • Gender
    Not Telling
  • Location
    Cornwall, England, UK,

Pudgemeister's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi Jessica, I actually came back to say I'd sorted the problem-and what you have done above is what I tried =D. Thanks for replying - I should think before asking next time hehe. Thank you =)
  2. Hi all, I've got an error I have yet to come across. "Strict Standards: Only variables should be passed in reference in my/file/name/here.php on line 69" It was quite a long line of code so by separating it out I have found the problem to lie here: $var = end(explode(".", $_FILES["file"]["name"])); It's not code breaking at all-but I am one for trying to be strict with my standards and making sure I get no notices or warnings let alone errors. Just interested in what I am not understanding. Thanks =)
  3. Thanks again guys-both of those explanations have helped me more than php.net or any other tutorial about autoloading This topic can be put as solved now...not sure if I do that or a mod does it-will check to see. Thanks
  4. Many thanks to you both. I had indeed come across autoloading in my searches for a solution-the problem I have with it is that I cannot for the life of me understand what it is doing/what it means etc. I feel like a fool for it :-\ I don't know why I didn't think about passing it through...that's a herp a derp moment for me there. I will be taking that route ^^ The simple solution is something I had already tried but it didn't work...I may have issues elsewhere. Thanks guys-you were a big help
  5. Hi All, BORING INTRODUCTION It's been many years since I was here-back when I last posted on phpfreaks I was but in my early teens and learning procedural php. I have since been through college, uni, and a decent web programming job where I have broadened my knowledge significantly to the point of doing everything in OOPHP . I know enough to get by but with some personal projects I am now working on I require a greater understanding of OOPHP (including calling things what they are e.g. object, method, property, etc (I always got mixed up with these). Apologies if what is below is a moment...but sometimes I don't quite understand what is written on these sites. THE PROBLEM I have my own simple custom DBAL. It works. I am now creating a class that needs the DBAL. The DBAL class file and class name are saved in a separate config file as constants. Something I have never been sure how to do (if possible) is if you can do the following: The class that needs DBAL access (separate file): public function __construct() { require('cfg.php'); require(DBAL_CLASS); $this->dbal = new DBAL_CLASS_NAME; } cfg.php <?php //Simpler directory desperator define('DS', DIRECTORY_SEPARATOR); //DBAL define('DBAL_CLASS', $_SERVER['DOCUMENT_ROOT'] . DS . 'db' . DS . 'index.php'); //Name of DBAL define('DBAL_CLASS_NAME', 'db'); A few things: The file name and directory for the DBAL is correct. I have tested echo'ing the constants in the class requiring the DBAL and they are point to the correct place. The only issue with this is that the path for the directory starts off using / and then DS goes to using \. Would this be an issue? I am aware that using constants in this way does not work. I have since edited this to assign the constants to variables as a temporary solution to that part, but I am still having problems. As I have mentioned above I am not from an OOP background and am doing my best to get to grips with it as I can see it's benefits over procedural and enjoy programming like this. LONG STORY SHORT I can't instantiate the class in the construct as I am trying there-well it won't work anyway. I am doing the exact same thing with another class in another file only a few lines later which works perfectly (i.e. I call methods from this other class in further methods in the current class). What have I done wrong? What could I do better? What is laughable? What have I done right? Any pro's and/or cons about the above would be greatly appreciated As I said above-a mixture of simple and not so simple stuff (or so it seems to me ). Thanks in advance, Pudgemeister
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.