Show Menu

Php + Yii code templates for NetBeans Cheat Sheet by hoplayann

This code template is based on the Yii/PHP NetBeans template downloadable here: http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/

Yii model methods

yafter­con­struct
yafter­delete
yafterfind
yaftersave
yafter­val­idate
yattri­but­elabels
ybefor­edelete
ybefor­efind
ybefor­esave
ybefor­eva­lidate
ybehaviors
ydefau­ltscope
yrelations
yrules
yscope
yscopes
yvalidator

Yii controller methods

yacces­srules
yaction
yactions
yafter­action
yafter­render
ybefor­eaction
ybefor­erender
ybehaviors
yfilters

Yii function calls

yaYii::app()
ybuYii::a­pp(­)->­baseUrl
ycaYii::a­pp(­)->­use­r->­che­ckA­ccess()
ydCVarDu­mpe­r::­dump()
ym${mode­lCl­ass­}::­model()
ytYii::t()
yuYii::a­pp(­)->user
yurlYii::a­pp(­)->­cre­ate­Url()
 

Yii generic methods

yinit
yrun

Yii view templates

ybegin­widget$this-­>be­gin­Widget
ybuYii::a­pp(­)->­baseUrl
ywidget$this-­>wi­dge­t(...)

Php print data

ecoecho(“­${m­ess­age}”); ${cursor}
prprint ${VARIABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"}; ${cursor}
prlnprint ${VARIABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"}."\n­"; ${cursor}
prsprint "­${c­urs­or}­";
prvprint "­\${­VAR­IABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"} = ".${­VAR­IABLE editab­le=­fal­se}."\n­"; ${cursor}

Php generics

clsclass ${Clas­sName} { function ${__co­nst­ruct}() { ${sele­cti­on}­${c­ursor} } }
fncfunction ${func­tio­nNa­me}­($$­${p­aram}) { ${sele­cti­on}­${c­ursor} }
ifaceinterface ${Inte­rfa­ceName} { ${cursor} }
ifncpublic function ${func­tio­nNa­me}­($$­${p­aram});
pconparent­::_­_co­nst­ruct(); ${cursor}
thrthrow new ${Exce­ption};
tryctry { ${sele­cti­on}­${c­ursor} } catch (${Exc­eption} $$${exc}) { echo $$${exc editab­le=­fal­se}­->g­etT­rac­eAs­Str­ing(); }
vdoc/ @var $$${VA­RIABLE variab­leF­rom­Nex­tAs­sig­nme­ntName defaul­t="v­ari­abl­e"} ${VAR_TYPE variab­leF­rom­Nex­tAs­sig­nme­ntType defaul­t="C­las­sNa­me"} /
 

Php statements

dodo { ${sele­cti­on}­${c­ursor} } while (${CON­DITION variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="b­ool­ean­" defaul­t="t­rue­"});
elifelseif (${CON­DITION variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="b­ool­ean­" defaul­t="t­rue­"}) { ${sele­cti­on}­${c­ursor} }
elselse { ${sele­cti­on}­${c­ursor} }
foreforeach (${ARRAY variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="a­rra­y" defaul­t="$­arr­ay"} as $$${va­lue}) { ${sele­cti­on}­${c­ursor} }
ifif (${CON­DITION variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="b­ool­ean­" defaul­t="t­rue­"}) { ${sele­cti­on}­${c­ursor} }
instif (${VAR­IABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"} instanceof ${Clas­sName}) { ${sele­cti­on}­${c­ursor} }
itdir$$${DIRH newVarName defaul­t="d­irh­"} = opendi­r($­{$d­irn­ame}); if ($$${DIRH editab­le=­false}) { while (($$${­DIR­_ELEM newVarName defaul­t="d­irE­lem­ent­"} = readdi­r($­{DIRH editab­le=­fal­se})) !== false) { ${sele­cti­on}­${c­ursor} } closed­ir(­$$$­{DIRH editab­le=­fal­se}); }
iterfor ($$${IDX newVarName defaul­t="i­nde­x"} = 0; $$${IDX editab­le=­false} < count(­${ARRAY variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="a­rra­y" defaul­t="$­arr­ay"}); $$${IDX editab­le=­fal­se}++) { ${sele­cti­on}­${c­ursor} }
swiswitch (${VAR­IABLE variab­leF­rom­Pre­vio­usA­ssi­gnment defaul­t="$­var­iab­le"}) { case ${$value}: ${sele­cti­on}­${c­ursor} break; default: break; }
whilewhile (${CON­DITION variab­leF­rom­Pre­vio­usA­ssi­gnment instan­ceo­f="b­ool­ean­" defaul­t="t­rue­"}) { ${sele­cti­on}­${c­ursor} }
 

Share This Cheat Sheet!

Favourited by 3 Members:

Theosis Dranzz hoplayann

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.