Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Euhm.. must have been quite late when I posted this. I meant: use the user-agent strings within the robots.txt file and match them with the HTTP_USER_AGENT string (some are missing of course: all the legit once, you should add these too). Obviously just putting a simple robots.txt in your root would do nothing. But you'll never be 100% sure to count only real user views and not bot views since they could use the User-Agent string of say Chrome or Firefox.. I think the main reason Google uses JS is to make sure it does not count crawlers (use a clever <noscript> to count those that have JS disabled?). IMO that's the way to go.
  2. Check out robots.txt @ http://browsers.garykeith.com/downloads Could be a good starting point.
  3. Yup. Here are a few resources to study what design patterns: http://martinfowler.com/eaaCatalog/ http://www.slideshare.net/spriebsch/basic-php-design-patterns-presentation http://www.ibm.com/developerworks/library/os-php-designptrns/ http://www.fluffycat.com/PHP-Design-Patterns/ My favourite is to use SlideShare.net to learn/understand new stuff.
  4. @thorpe I really like how Proem has evolved. Any word on an expected release candidate?
  5. OT: And by that we mean ALL globals! Even superglobals like _GET and _POST unless the class has been specifically written to deal with them like a HttpRequest class. There are better alternatives than using the 'global' keyword AND not having to pass the db instance with every instantiation, it's called: Dependency Injection and you can find a few good packages on github, I favor those by Fabien Potencier but there are others. Basically they allow you to get an instance of an object without having to worry about passing all the required arguments, something like this (from my earlier example): $smarty = $container['smarty']; $articles = $container['newsarticles']; $smarty->assign('articles', $articles->listLatest()); $smarty->render('template.tpl');
  6. I had to google 'mike hunt' before I understood what the joke was about.. LOL.
  7. var props = [], i = proplist.length; while (i--) { if (proplist[i].someproperty == 'somepropertyvalue') { props.push(proplist[i]); // valid } }
  8. I agree with AyKay. There is NEVER a good reason to use global, EVER!
  9. http://www.iconfinder.com/search/?q=hand There are other websites like this one out there. Good luck.
  10. No, you don't. Compare the below versus your code. class NewsArticles { private $db; public function __construct(PDO $db) { $this->db = $db; } public function listLatest() { return $this->db->query('SELECT * FROM news LIMIT 5'); } } $articles = new NewsArticles($pdoInstance); foreach ($articles->listLatest() as $article) { echo $article['title']; } And ALWAYS separate your presentation (HTML) from your business logic. $smarty = new MySmarty; $articles = new NewsArticles($pdoInstance); $smarty->assign('articles', $articles->listLatest()); $smarty->render('template.tpl'); template.tpl <html> <body> {foreach $articles as $article} {$article.title} {/foreach} </body> </html> Or using PHP as a template engine: <html> <body> <?php foreach ($articles as $article): ?> <?=$article; ?> <?php endforeach; ?> </body> </html> The above is much cleaner then: <html> <?php require_once('functions.php'); require_once('news.php'); ?> <body> <?php functions::dbConnect(); $news = new news(); $newsresultset = $news->getNews(); while($row = mysql_fetch_assoc($newsresultset)) { echo $row['title']."<br />"; } ?> </body> </html>
  11. LOL. So true. Thx Philip.
  12. MySQL will do just fine. Just be sure to define proper indexes.
  13. I agree with RobertP, use a database. Optimize your queries with indexes.
  14. Can you describe what you are trying to do? Why are you looping over 15 -> 600 and what do you mean by "all the way up to 600$ or if the max_Stars get's up to 80?"
  15. You don't need the count_words function just use str_word_count like i showed you earlier.
  16. Post your code. Why did you set the topic to solved if you are still having an issue?
  17. No need to remove the punctuation, str_word_count is intelligent enough to know that punctuation is not a word. echo str_word_count($description);
  18. I've heard phpfreaks.com to be quite good. Speedy responses! Overall friendly folks! Best not to feed .josh though Only after midnight, and keep him away from water ..in a bottle, with an alcohol percentage at the bottom.
  19. Ohoh premiso will go berzerk when he finds out you revived a dead topic... Didn't you get the memo?
  20. I've heard phpfreaks.com to be quite good. Speedy responses! Overall friendly folks! Best not to feed .josh though
  21. This topic is continued here: http://www.phpfreaks.com/forums/index.php?topic=354599.msg1675366 Please let this topic die!
  22. The table structure could be something like (not all fields are included): student (s_id, s_fname, s_lname) student_action (sa_id, sa_name, sa_demerits, sa_merits) student_log (sl_id, s_id, sa_id, sl_attributed_at) Where student, student_action, and student_log are all tables. s_id, sa_id, and sl_id are primary keys. Example rows would be: student table (s_id, s_fname, s_lname) 1, Foo, Bar 2, Baz, Bat student_action table (sa_id, sa_name, sa_demerits, sa_merits) 1, Late Sign In, 1, 0 2, Late Assignment, 2, 0 3, 3 month Merit earned, 0, 1 student_log table (sl_id, s_id, sa_id, sl_attributed_at) 1, 1, 1, 2012-02-27 2, 1, 2, 2012-02-27 3, 1, 3, 2012-02-27 As you can see, changing the number of merits/demerits an action accrues will be reflected in the student_log table. Thus changing the number of demerits for Late Sign In from 1 to 2 will increase the total for each line (for that particular action) in the student_log for a certain student. To easily create mysql tables you could use HeidiSQL or possibly your webhost already has PHPMyAdmin installed, which can be used aswell to create the tables. The query would be something like: SELECT s_id, sl_attributed_at, sa_name, sa_demerits, sa_merits FROM student_log JOIN student_action USING(sa_id) WHERE s_id = ? You would use PHP to total each line. This should be enough to get you started. Possibly you may want to add years (2012-2013) to the design. When a student is in his last year, you probably don't want to count the demerits/merits he caught his first year. Post any questions that you may have.
  23. How did you make fire? The very fear of not being able to light up their cig forced them to invent the lighter.. no need for sticks.
  24. What do you want help with? Do you have written any code? Please keep your question to one forum http://www.phpfreaks.com/forums/index.php/topic,354598.html Since it's probably about PHP keep it to this one.
  25. What do you want help with? Do you have written any code?
×
×
  • 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.