Zend Studio Code Templates Table


Pokud používáte automatické doplňování kódu v Eclipse (Zend Studiu) bude se Vám hodit následující tabulka šablon. Pokud nevíte jak ji použít, zkuste v editoru napsat například "cls" a stisknout "ctrl+space". Vlastní šablony si můžete přidat v nastavení: Window->Preferences->PHP->Editor->Templates.


classclass statement
class ${class_name} {
	function ${function_name}() {
		${cursor};
	}
}
clnClone an object
${dollar}${new_obj} = clone ${dollar}${variable};
${cursor}
closurelambda function statement (closure)
function (${parameters}) use (${lexical_variables}) {
	${cursor};
}
clsclass statement
class ${class_name} {
	function ${function_name}() {
		${cursor};
	}
}
ecoecho a string
echo("${}");
${cursor}
elifelseif statement
elseif (${condition}) {
	${cursor};
}
elselse statement
else {
	${cursor};
}
fncfunction statement
function ${function_name}() {
	${cursor};
}
forfor statement
for (${dollar}${index} = 0; ${dollar}${index} < ${number_variable}; ${dollar}${index}++) {
	${line_selection}${cursor}
}
foreforeach statement
foreach (${dollar}${array_expression} as ${dollar}${value}) {
	${cursor};
}
forekforeach with key statement
foreach (${dollar}${array_expression} as ${dollar}${key} => ${dollar}${value}) {
	${cursor};
}
functionfunction statement
function ${function_name}() {
	${cursor};
}
ifif statement
if (${condition}) {
	${cursor};
}
instinstanceof statement
if (${dollar}${variable} instanceof ${class}) {
	${cursor};
}
itdiriterates a directory
${dollar}${dirh} = opendir(${dirname});
if (${dollar}${dirh}) {
	while (${dollar}${dir_element} = readdir(${dollar}${dirh})) {
		${cursor};
	}
	unset(${dollar}${dir_element});
	closedir(${dollar}${dirh});
}
iteriterates an array
for (${dollar}${number_variable} = 0 ; ${dollar}${number_variable} < count(${dollar}${array_variable}) ; ${dollar}${number_variable}++) {
	${cursor};
}
lambdalambda function statement (closure)
function (${parameters}) use (${lexical_variables}) {
	${cursor};
}
my_famysql_fetch_array() loop
while (${dollar}${row} = mysql_fetch_array(${dollar}${query})) {
	${cursor};
}
my_fomysql_fetch_object() loop
while (${dollar}${row} = mysql_fetch_object(${dollar}${query})) {
	${cursor};
}
my_frmysql_fetch_row() loop
while (${dollar}${row} = mysql_fetch_row(${dollar}${query})) {
	${cursor};
}
my_gcTrap code output
ob_start();
	
${cursor};

${dollar}${contents} = ob_get_contents();
ob_end_clean();
nsnamespace statement
namespace ${name};
pclonCall parent's clone
parent::__clone();
pconCall parent constructor
parent::__construct();
${cursor}
prprint an expression
print ${};
${cursor}
prcprints the current class name
print("${class_container}");
${cursor}
prfprints the current function name
print("${function_container}");
${cursor}
prlnprint with new line
print ${}."\n";
${cursor}
prsprint a string
print "${}";
${cursor}
prvprint a value
print("\${dollar}${variable} = ". ${dollar}${variable});
${cursor}
swiswitch statement
switch (${dollar}${variable}) {
	case ${value}:
	${cursor};
	break;
	
	default:
		;
	break;
}
trytry catch block
try {
	${cursor}
} catch (${Exception} ${dollar}e) {
}
useuse statement
use ${namespace} as ${alias};
whilewhile loop
while (${condition}) {
	${cursor};
}