HTML5 Boilerplate

HI,

Does anyone have a tutorial or some samples of integrating HTML5 Boilerplate with Yii?

Thanks!

Hi,

Has anyone integrated HTML5 Boilerplate with YII? ANd, specifically the build process?

Thanks

HTML5 has brought about this necessity at our place aswell.

I saw an article a while back describing how to simplify it, but I have unfortunately lost the link. And, Google (for once) is no help. :)

The questions I really have relates to the merging of the folder structures between Yii and BP, as well as once this have been merged, how to still utilize the BP build script. Also curious about how the BP HTML template fits into the Yii generated pages.

BP HTML template fits well. See http://yiicookbook.org/. As for build script, I’ve not used it yet.

Can’t say it’s “integrating” but http://yiicookbook.org/ was done using it as a base.

NOTE: merged two similar topics

I am using only HTML5 boilerplate code. And I am not building it. You don’t need to unless you are making releases. Download, modify views/layouts and maybe adjust some views, and that’s it. :)

I always use it with a theme, so enable themes first.

Put the files in ‘classic’ and get started.

HTML5 - the word of the moment… we too are in search of people to join our co. to take care of all upgrade and integrate.

I had been looking to do the same. There is an html5boilerplate theme available on github. A google search should get you there. Also, I was looking for a way to use email, number and URL fields instead of just text fields. (As they are backwards compatible by default).

This is what I did. The tweaks are small enough that they don’t warrant a whole new download:

in YiiRoot/framework/web/helpers/CHtml.php

    public static function textField($name,$value='',$htmlOptions=array())


{


	self::clientChange('change',$htmlOptions);


	return self::inputField('text',$name,$value,$htmlOptions);


}





[b]public static function emailField($name,$value='',$htmlOptions=array())


{


	self::clientChange('change',$htmlOptions);


	return self::inputField('email',$name,$value,$htmlOptions);


}





public static function urlField($name,$value='',$htmlOptions=array())


{


	self::clientChange('change',$htmlOptions);


	return self::inputField('url',$name,$value,$htmlOptions);


}





public static function numberField($name,$value='',$htmlOptions=array())


{


	self::clientChange('change',$htmlOptions);


	return self::inputField('number',$name,$value,$htmlOptions);


}[/b]

&&

    public static function activeTextField($model,$attribute,$htmlOptions=array())


{


	self::resolveNameID($model,$attribute,$htmlOptions);


	self::clientChange('change',$htmlOptions);


	return self::activeInputField('text',$model,$attribute,$htmlOptions);


}





public static function activeEmailField($model,$attribute,$htmlOptions=array())


{


	self::resolveNameID($model,$attribute,$htmlOptions);


	self::clientChange('change',$htmlOptions);


	return self::activeInputField('email',$model,$attribute,$htmlOptions);


}





public static function activeUrlField($model,$attribute,$htmlOptions=array())


{


	self::resolveNameID($model,$attribute,$htmlOptions);


	self::clientChange('change',$htmlOptions);


	return self::activeInputField('url',$model,$attribute,$htmlOptions);


}


public static function activeNumberField($model,$attribute,$htmlOptions=array())


{


	self::resolveNameID($model,$attribute,$htmlOptions);


	self::clientChange('change',$htmlOptions);


	return self::activeInputField('number',$model,$attribute,$htmlOptions);


}

in YiiRoot/framework/web/widgets/CActiveForm.php

        public function textField($model,$attribute,$htmlOptions=array())


{


	return CHtml::activeTextField($model,$attribute,$htmlOptions);


}





public function emailField($model,$attribute,$htmlOptions=array())


{


	return CHtml::activeEmailField($model,$attribute,$htmlOptions);


}





public function urlField($model,$attribute,$htmlOptions=array())


{


	return CHtml::activeUrlField($model,$attribute,$htmlOptions);


}





public function numberField($model,$attribute,$htmlOptions=array())


{


	return CHtml::activeNumberField($model,$attribute,$htmlOptions);


}

This lets you use the the new input elements in Forms. Also You can add more if you want. I just needed these three.

Hi, nice idea nmn.

I’d change also all the “/>” closing tag strings into “>” as per HTML5 standards.

There are 7 occurrences of them in CHtml.php (in Yii 1.1.10 anyway)

Edit: and maybe extend CHtml class instead of modifying it?