Archive

Archive for February, 2009

Advertisements in phpBB3

February 28th, 2009

The article below shows the different way of embedding advertisements in phpBB3:

http://www.phpbb.com/kb/article/advertisements-in-phpbb3/

However, if you tried editing the template files and the advertisements are not showing up, you will have to clear phpBB3 cache, not the browser cache that we normally clear.

By default, phpBB3 keep a cache of the template for faster generation time and reduce server load. So after editing the template files, go to administration control panel.

Click on Styles tab, follow by Templates under Style components on the left-hand menu. Then, click on cache, marked all template files and delete.


An example below:

Refresh your browser on the phpBB3 forum and the advertisements should appear as on how you edit your template files!

* Sorry for the above unclear image, the actual size just doesn’t fit my template.

Willie Programming ,

CakePHP 1.2 favicon

February 23rd, 2009

In CakePHP 1.2 default layout, favicon are linked through:

1
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

The problem with this is that when you navigate to other views (except for the default controller and view it loads), the favicon will disappear. This is because the path to the favicon is lost.

There is also a mistake in CakePHP 1.2 Manual at here

The $html->meta has the wrong values fed into it and the parameters doesn’t match what the API desribe at here.

Hence, following the manual in CakePHP 1.2 will not works in displaying the favicon correctly. If we were to use $html->meta parameters as what it was describe in the API like below:

1
<?= $html->meta('icon', /favicon.ico'); ?>

We will get:

1
<link href="/favicon.ico" type="image/x-icon" rel="icon" />

The correct path is still not being generated !

To resolve this, we made use of $html->url from CakePHP 1.1 :

1
<?= $html->meta('icon', $html->url('/favicon.ico')); ?>

Now, the path of the favicon will be generated correctly and displayed in all views when using CakePHP 1.2

Willie Programming , ,

SHOEI helmet

February 21st, 2009

Why this Japanese-made helmet so expensive?

Tell me why! Tell me WHY!!!

Is it because Made in Japan?

Is it because got Japanese girls kiss the helmet many many times?

Is it because the name sound like Shogun (General in Japanese) ?

Or is it because Japanese girls wear until smell like perfume?

Why?!?!?! WHY WHY WHY !!!!

Willie Uncategorized

Government so good?

February 19th, 2009

Give me GST package. $200 for March, $200 for July.

In no time, these money will be spend amazingly fast. This is just a short-term plan. Everyday I pay the stupid GST, $400 can last me how long?

Think…

Willie Life

Controller without Model in CakePHP

February 11th, 2009

Sometimes, we may have a controller that doesn’t required a model in CakePHP. However if there is no Model with a singular name correspond to the controller, CakePHP will return a error of no Model being found.

To resolve this, define the controller variable of uses:

var $uses = null; //declare that this controller has no model

In this way, the error will not be shown because we have specify that the controller does not have any model.

An overview example are as follow:

1
2
3
4
5
6
7
8
9
10
11
12
<?php
class CompaniesController extends AppController {
   var $name = 'Companies';
   var $uses = null; //declare that this controller has no model
   var $layout = 'default';
   var $helpers = array('Html', 'Javascript', 'Time', 'Ajax');
 
   function about_us() {
      $this->pageTitle = "About Us";//will load the view, about_us.ctp
   }
}
?>

Hope this helps!

Willie Programming , ,

I am half deaf

February 9th, 2009

Due to ear infections on my left ear, I have hearing loss now. I went to the doctor, the doctor told me to prepare for the worst.

If I still can’t regain my hearing after one week, I will need to rush myself to the Emergency department in any hospital. Because I could have permanent hearing loss.

Sad case ~

Willie Life

Open/Edit .thtml with Dreamweaver CS3

February 7th, 2009

CakePHP default file extension for the views template are in .thtml

As such, Dreamweaver will not be able to show the color code of PHP code embedded inside the views. To allow .thtml to be open as a normal PHP file with the corresponding color code, do the followings:

  • Open dreamweaver_installation_folder\Configuration\DocumentTypes\MMDocumentTypes.xml with any text editor and find out the line containing winfileextension=”php,php3,php4,php5″
  • Add ‘,thtml’ at the end of this string like this: winfileextension=”php,php3,php4,php5,thtml”
  • Navigate to dreamweaver_installation_folder\Configuration\ directory
  • In Extensions.txt, you need to add ‘,THTML‘ to the first line (just before the colon is a good place), so it ends in: ,THTML :All Documents
  • And line 16 you need to add ‘,THTML‘, again before the colon: ,THTML :P HP Files
  • Go to Start -> Run -> Open, type %APPDATA%
  • Navigate to Adobe\Dreamweaver 9\Configuration folder
  • Copy the edited Extensions.txt and replace the one resided in Adobe\Dreamweaver 9\Configuration folder

Close your Dreamweaver if it is opened; start it and you will see that .thtml have the same color code as .php

Source: http://anupom.wordpress.com/2007/01/08/configuring-dreamwaver-8-for-editing-thtml/

Willie Programming ,

Add me QQ ?

February 5th, 2009

I am sick of MSN. Xiao ming and I are playing around with QQ. Yes, the china “MSN” version.

Anyone add me?

QQ: 859937748

Willie Uncategorized

My Pet

February 3rd, 2009

Remember to take a look of my pet @ http://xbfish.info/?page_id=117
:D

Willie Uncategorized