Jump to content

cngodles

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cngodles's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Like: <script type="text/javascript" src="http://www.somesite.com/core.js" language="javascript"></script> That's how I used to do include files before I learned PHP, lol.
  2. I'll give http://devzone.zend.com/node/view/id/638 a try and see where it brings me. It looks a bit more promising. Maybe one more thing I could ask. Say I'm programming a blog. In fact, I recently came up with a great set of functions for my best tag based blog yet. That's something I may reprogram in OO PHP. What are the possible benefits of doing a blog in OO PHP vs a function list? And thanks for the encourangement and discussion. It helps big time.
  3. Ok, here is my dilemma. I've been a PHP writer for 5 years, have been getting paid to do it full time for almost 4. I recently missed a good opportunity because I didn't know enough OO PHP. Ok then, I say, lets learn it. So I printed out the OO PHP Part 1 tutorial, and I read a great article somewhere on the strengths and weaknesses. It sucks that OO PHP is becoming sort of a standard. It's spliting PHP in half in terms of usage. I have to jump over to the better side and the split is the learning. If someone handed me an OO PHP class right now and said use it, I'd struggle big time. PHP is often praised for being super easy to learn. I'm all for the learning. I've read the article twice, and I could probably spit out a good class right now. I'm still having trouble justifing the extra work. Within the past 2 years, I've started to develop entirely using functions. Everything I do is usually a function. I use this one a ton: <? function super_property($table, $id, $property){ $sql = "SELECT `$property` FROM `$table` WHERE `id` = '$id'"; $query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error()); $result = mysql_fetch_array($query); return stripslashes($result[$property]); } ?> So I have a large function file that I use for most websites. In new projects I reuse a ton of them, and add in what is missing. Now this thread is half gripe, half motivate me. In the end, I will learn OO php, and I will start to use it. I'm just having a hard time finding the point. It's extra code. When I roll a function into a class, I have to add lots of $this-> in front of variables. Sure you can just call a class when you need it, but you can call a function list as well. I'm sure you get a large amount of posts like this, so don't let me bother you. I think I just need encouragement either way, or some helpful tips for learning it and getting it down. Thanks! Clint
  4. That method is exactly what I needed. As per one of my previous projects, we had a script that would gather data from lots of sources, then display a number, usually an average. There were about 6,000 users for the site, and what small percentage of that were logged in were adding data. So, I would delete the cached number whenever someone would insert data, then update the cached number when someone requested it when there was no cache present. Would it make more sense to do this with a flat file of some sort? I've heard of memcache, but I'm not sure where to start with that.
  5. I'm not 100% sure, but I would assume they work like Google Analytics where they link to an external .js file. Your allowed to do that, then anything that company runs on their own site is ok within their domain. That then gets returned to your site via the .js inclusion.
  6. Yeah, I'm pretty sure you can't load pages from other servers using ajax. Javascript just doesn't allow it. Kinda smart, I could imagine a bad page that interactivly loaded bad content from many different sources.
  7. I've always used something like: if($_POST['do'] != ''){ //do whatever... }
  8. I would definatly not do AJAX for an entire site. That is the same thing Flash websites have trouble with. While you may believe it speeds things up, your sacrificing a useful part of the User Interface (The Back/Formard Buttons) for a nifty gimmick.
  9. Is there a way to cache without actually refering to the database? In my opinion, you would cache to save database calls, but is that a correct assumption?
  10. mithras: You use the following in your example: $result = db::query( "SELECT * FROM products" ); Is the db:query a common way to send a query, or is there additional code that goes along with that. I myself have been coding PHP for 5 years, and I'm just now getting into OO PHP, and I'm trying to both grasp and justify it's use. Thanks! Clint
×
×
  • 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.