Month: May 2007

array_fill()

Definition and Usage

The array_fill() function returns an array filled with the values you describe.

Syntax

array_fill(start,number,value)


Parameter Description
start Required. A numeric value, specifies the starting index of the key
number Required. A numeric value, specifies the number of entries
value Required. Specifies the value to be inserted



Example

<?php
$a=array_fill(2,3,"Dog");
print_r($a);
?>

The output of the code above will be:

Array ( [2] => Dog [3] => Dog [4] => Dog )
Advertisement

How to make dreamwearver to recognize .thtml files of cake PHP

CakePHP is a marvelous PHP framework, but if you use Dreamweaver 8 as your editor, you’ll need to make a few configuration changes.

The main thing you’ll notice is that .thtml files (CakePHP views) are not supported by Dreamweaver 8. Here’s how to make Dreamweaver recognize that file type:
Step 1: Extensions.txt

The first step is to go to the C:\Program Files\Macromedia\Dreamweaver 8\Configuration directory and edit Extensions.txt

On the first line, right before :All Documents, type in ,THTML so that the end of the line looks like this:

…,VTML,INC,JAVA,EDML,WML,THTML:All Documents

Next, find the line with :PHP Files and edit it similarly so that it looks like this:

PHP,PHP3,PHP4,PHP5,TPL,THTML:PHP Files

Another copy of Extensions.txt can be found in C:\Documents and Settings\<your username>\Application Data\Macromedia\Dreamweaver 8\Configuration – we suggest that you make both these changes in that file as well, just for good measure.
Step 2: MMDocumentTypes.xml

Next, go to the C:\Program Files\Macromedia\Dreamweaver 8\Configuration\DocumentTypes directory. Edit the file MMDocumentTypes.xml

Add the thtml extension to the PHP_MYSQL documenttype declaration line so that it looks like the following:

<documenttype id=”PHP_MySQL” servermodel=”PHP MySQL” internaltype=”Dynamic”
winfileextension=”php,php3,php4,php5,thtml”
macfileextension=”php,php3,php4,php5,thtml”
file=”Default.php” writebyteordermark=”false”>

Save the file and restart Dreamweaver – now you can create Cake PHP views within Dreamweaver!

If you find this information is userful then leave a comment.