Jump to content

phpFirstJoy

Members
  • Posts

    32
  • Joined

Everything posted by phpFirstJoy

  1. Do you know if there's an easy way to do that than to redraw them? Some kind of masking maybe? It takes a while for me to draw them cause I'm not very good with the pen tool yet.
  2. lol I'm finding that small changes make huge differences. I do feel more comfortable with it now though I'm a bit nervous about the ad space - I'll try to take better photos with backdrops. Think that will make it better?
  3. Ok, I made some more changes - fixed the colours a bit (I redid the shopping bags!) Other than the box below the photograph of the bracelet, I don't have any pink... Does it look pink at the bottom? I was trying to fade the plaster-looking background to something solid. The photograph is where my ads and promotions will appear. Not sure how I can change that, any ideas? BTW, I did click your link even though you told me not to Here's the updated image: [redacted by request] What do you think?
  4. Hello, I redesigned my current store but I hated it and people seem to agree! So I created a new design but it still doesn't feel right. Would really appreciate some critiques and suggestions. Here it is: [redacted by request]
  5. Is it safe for me to assume that both arrays are sorted by date/time order? If so, you could probably "cheat" a little by taking the first payment and checking it against the first deposit. Are they equal? If not, add the second payment to the first payment. Is the new total equal to the first deposit? If yes, increment to the second deposit and so on. It's not very elegant but it might get the job done!
  6. I think your config paths are not pointing to the right places. You may want to check those. No images/formatting is a good sign of that - at least that's what I experienced when getting Symfony to work.
  7. I don't think it restricts the programmer from developing with PHP5 though - similar to CodeIgniter and CakePHP. I thought the only two major frameworks that completely rely on PHP5 is Zend and Symfony and I hated them both for tasting like pound cake. But anyway, I digress... was wondering if anyone has used it and if they have, how did they find it?
  8. But so are the popular CakePHP, CodeIgniter, and others. Only a few truly use PHP5 only... In all fairness, the choice of PHP flavour technically shouldn't make this framework any worse than the others because it uses PHP4, imho.
  9. Just curious if anyone has used Akelos before? http://www.akelos.org/ It looks quite interesting but their community is reminiscent of a graveyard... :-\
  10. Slightly off-topic... My 2 cents: you can also use MVCL (L for language) which can possibly, in the future, assist you in translating sites into different languages without hassle.
  11. I don't think the captcha will stop brute force attacks - it's there to keep bots from automatically filling out your forms and submitting a massive number of user name signups, at least that's how I understood it. (Edit: spelling)
  12. You will need to play around with the included stylesheet. The stylesheet controls where things display and how they are displayed.
  13. Ditto on all three points! Plus it's one less set of syntax to memorize which is always good for the Alma mater.
  14. I guess I can't put off setting up Eclipse any longer, can I? Anyway, I think I found it! home.php $this->document->title = sprintf($this->language->get('title'), $this->config->get('config_store')); $this->document->description = $this->config->get('config_meta_description'); and in index.php // Router if (isset($request->get['route'])) { $action = new Router($request->get['route']); } else { $action = new Router('common/home'); } ... the else is called at default. The puzzle is complete! Ah, I get it now. Another site attributed the Registry as a temporary basket. I guess you could also look at it as a grocery basket - unless you place products back on the shelf, each page and all its elements are in the basket until you pay for it at the checkout counter. Then it gets dumped and emptied onto your screen. But what a mess! The code is strewn all over the place. Thanks, gizmola, you're a life-saver! And I learned more stuff! I think I'll stick around - it's so much nicer at this board knowing that there's someone who actually replies regardless of whether they know what's going on or not. I get more help in a random forum from a random person in four days than at OpenCart dev (two weeks and counting and I'm not even graced with an insult, rude reply, or anything). Not to mention I'm going through the code primarily to fill their non-existent documentation and code comments as a contribution to the OpenCart community... sheesh! No wonder people would rather get paid for it - free help isn't very much appreciated these days! [/end vent] Anyway, thanks again!
  15. Is it the scope resolution operator? Like in here... // Config $config = new Config(); Registry::set('config', $config); So Config is instantiated but Registry is not. Config is placed into Registry but because the both have similar methods and members (particularly $data and __get() and __set()), the Registry ones take precedence (its members and methods are set to static) and overload the Config ones. So, when this is done... foreach ($query->rows as $setting) { $config->set($setting['key'], $setting['value']); } It is actually Registry::set($setting['key']....)? Did I get it right? Or am I still a bit off?
  16. Hello, thanks for the reply - much appreciated. I read up on the stuff you suggested and I think I get it so I went back and tried following the code with the magic methods in mind. Unfortunately, I've hit another roadblock... I got to the end of one of the classes but that's it... somehow, the members seem to be automatically populated without any methods! I hope it's ok if I post the relevant snippets of code... index.php // Config $config = new Config(); Registry::set('config', $config); // Database $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PREFIX); Registry::set('db', $db); // Settings $query = $db->query("SELECT * FROM setting"); foreach ($query->rows as $setting) { $config->set($setting['key'], $setting['value']); } // Document Registry::set('document', new Document()); controller.php abstract class Controller { protected $id; protected $template; protected $layout; protected $children = array(); protected $data = array(); protected $output; protected function __get($key) { return Registry::get($key); } protected function __set($key, $value) { Registry::set($key, $value); } registry.php final class Registry { static private $data = array(); static public function get($key) { return (isset(self::$data[$key]) ? self::$data[$key] : NULL); } static public function set($key, $value) { self::$data[$key] = $value; } layout.php class ControllerCommonLayout extends Controller { protected function index() { $this->data['title'] = $this->document->title; $this->data['description'] = $this->document->description; layout.tpl <title><?php echo $title; ?></title> <?php if ($description) { ?> <meta name="description" content="<?php echo $description; ?>" /> <?php } ?> document.php final class Document { public $title; public $description; public $base; public $charset = 'utf-8'; public $language = 'en-gb'; public $direction = 'ltr'; public $links = array(); public $styles = array(); public $scripts = array(); public $breadcrumbs = array(); } I followed index.php first. Here, config is instantiated and dropped into the Registry. It is then populated with settings from the database. Document is also dropped into the Registry. Then, in layout.php, we assign the key 'title' to the data array in Controller with a value of $this->document->title. Since Controller doesn't have the document class, the __get() method is called which in turn calls the __get() method from the Registry. The Registry __get() refers back to itself and looks for the Document class (which it finds) and pulls out the value from $title. After that, we render the page (code not shown) and output to the template (layout.tpl). $title and $description are replaced with their respective values from $data['title'] and $data['description'] that was defined in the Controller. Here's where I'm stuck; how does the data from Config end up in the public members of Document? ??? I've checked the other files available and there doesn't seem to be anything that does that. I did see in language.php something that I was expecting for Document. language.php final class Language { private $code; private $languages = array(); private $data = array(); public function __construct() { $this->config = Registry::get('config'); $this->db = Registry::get('db'); $this->request = Registry::get('request'); $this->session = Registry::get('session'); $query = $this->db->query("SELECT * FROM language"); See how __construct() calls and loads the config, request, session, and db classes? I didn't post all the code but it goes on to pull data from the DB and loads it into the private data array. That makes sense to me... the Document class... Would really appreciate the help!
  17. Hello, I'm trying to figure out how the backend of OpenCart works as way to learn PHP classes. Unfortunately, I'm stuck - very very stuck - and I'm hoping someone can handhold me through this little hurdle... I'm looking at layout.php found in catalog/controller/common/. layout.php makes the following call: $this->data['title'] = $this->document->title; I understand the first part ($this->data['title'] = ) but I can't figure out what the data array is being set to. I know it's the $title of the store which is pulled from index.php under "Settings" but how does the data array in Config get transferred to members in the Document class? I think it has something to do with the Registry but I just can't seem to get it. Would greatly appreciate some help!
  18. Nevermind. I solved it. It should be corrected to: $query = "INSERT INTO blog_diary_entries (IndexID, CreateDate, EntryTitle, Entry, Author) VALUES (NULL, '2007-10-26 20:49:19', '$title', '$entry', 'ef')"; $result = mysql_query($query);
  19. Hi, I'm having difficulty understanding why the following is correct: $query = 'INSERT INTO blog_diary_entries (IndexID, CreateDate, EntryTitle, Entry, Author) VALUES (NULL, \'2007-10-26 20:49:19\', \'' . $title . '\', \'' . $entry . '\', \'ef\')'; $result = mysql_query($query); but the following would be wrong: $query = "INSERT INTO blog_diary_entries (IndexID, CreateDate, EntryTitle, Entry, Author) VALUES (NULL, \'2007-10-26 20:49:19\', \'' . $title . '\', \'' . $entry . '\', \'ef\')"; $result = mysql_query($query); and the following would also be just as wrong: $query = "INSERT INTO blog_diary_entries (IndexID, CreateDate, EntryTitle, Entry, Author) VALUES (NULL, \'2007-10-26 20:49:19\', \'" . $title . "\', \'" . $entry . "\', \'ef\')"; $result = mysql_query($query); I can only see that " (double quote) is not accepted in the query (I also tried using them before $title and after $title - see also $entry) even if I use them in the correct order and such but somehow ' is the only thing that I can use. Would someone be able to explain this to me? It's driving me nuts! -- Driven Crazy
  20. Hi, I'm trying the example given in the PHP Manual... $str = "A 'quote' is <b>bold</b>"; // Outputs: A 'quote' is <b>bold</b> echo htmlentities($str); // Outputs: A &#039;quote&#039; is <b>bold</b> echo htmlentities($str, ENT_QUOTES); ... but instead of the expected output, I get the following: A 'quote' is <b>bold</b> Exactly like that. Shouldn't it show the escaped characters with the < > stuff? ??? Would appreciate some insight. Thanks!
  21. Hi everyone, thanks for all the suggestions! I will definitely try them out. (this is so difficult!) but hopefully, I'll get used to it and I won't load too much stuff in the future.
  22. I'm interested in this too. Would it be easier to simply make a "snapshot" of the original, change it, and store it? I don't know how memory intensive this would be for large chucks of text but if it's not much then it sounds like the easiest way to do it. You can even compare the changes from the most current version with the previous versions with a simple character-by-character comparison I would believe. Or maybe for each revision, the original document is only changed with dated tags around the original part. Subsequent changes to that part would result in more tags like so... Original [010120071201]1st revision to [/010120071201]original (Jan. 1, 2007 12:01am) [010120071201][010220071201:2]1[/010220071201]nd revision to [/010120071201]original (Jan. 2, 2007 12:01am with change from 1 to 2) Output: Original 1st revision to original 2nd revision to original and so forth. Then we can parse the timestamped tags and show the most recent changes (if the user requests that) or an earlier version. Well... scratch that... this looks too complicated I'm sure there's an easier way.
  23. Thanks for the reply! Hmmm well, they are small files but there are a lot of parent and child classes all linked together. Then most of the functions/methods need to connect to the database. Maybe I'm opening too many connections... would it work if I do something like this... <?php //include_once class 1 //include_once class 2 //.... //create the class object 1 //create the class object 2 // etc... //open database ... ?> I'm just concerned that because I create my class objects before the database connection is opened, that they won't be able to do anything. Should I create the objects after I create a link to the database? Would this be a better solution than opening the database within the parent/child classes themselves (I only do it when it's needed in the function then I close it right away)?
  24. 74 views by so many including experts but no suggestions? Kinda depressing... :-\
×
×
  • 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.