Notes

This is a selection of "notes" that I make as I work. You may find some interesting stuff here. Some of the notes will be developed into proper blog posts later. Essentially this is a tool for my own benefit, but may help you as well.

Removing reply link in comments and forums

The following code will remove the reply link in comments. This includes comments in forums ie, the reply to a topic. The following code goes in the template.php file in the theme.

function _phptemplate_variables($hook, $vars = array()) {
    switch ($hook) {     
    case 'comment':
    $linksexpl = explode("</li>", $vars['links']);
    $link1 =  "$linksexpl[0]</li>";
    $link2 = "$linksexpl[1]</li>";

..read more

Improving server performance

Some tips to improve performance of the server, including page load speeds:

  • Use Innodb as the MySQL engine
  • Activate slow query log to identify expensive queries
  • Index tables
  • Enable MySQL query cache
  • PHP caching - cache scripts in their complied state - using eAccelerator
..read more

Building a web crawler

use wget from PHP to get the page(s) you want to, then use preg_match with a regular expression to get the title, the text, the source, links, images, etc from the page

..read more

MySQL Select Count Group

MySQL command to count the number of entries for a group

SELECT field_to_count, count(id) FROM `table_name` group by field_to_count

..read more

Testing Firefox Scribefire

I am currently testing the Scribefire Firefox Addon. It will allow you to add blog entries from Firefox.

Steps I have taken:

..read more