Articles for HTML

In case you want to copy text (or HTML) to CKeditor on your form using JavaScript, you should use following snippet: 1 2 var oEditor = CKEDITOR.instances[’entity_id’]; oEditor.setData( some_text_to_copy_to_ckeditor ); To copy HTML from CKeditor: 1 2 var objEditor = CKEDITOR.instances[’entity_id’]; var some_html_value_from_ckeditor = objEditor.getData(); At last, if you would like to append text (or [...]

Div position center

In: CSS

26 Jul 2010

To position div in center of your HTML, you should set divs margin to auto. Use style from following snippet to position your div in center of html. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <head> <style> div.center { margin: 0 auto; width: 200px; height: 200px; background: #2abada; [...]

Video HTML 5

In: HTML5

3 Jul 2010

If you want to implement video HTML 5 player, you can do it by using following code: 1 2 3 4 5 <video width="640" height="480" controls="controls"> <source src="video.mp4" type="video/mp4" /> <source src="video.ogg" type="video/ogg" /> Your browser does not support the video HTML 5. </video>

PHP find image

In: PHP

29 Jun 2010

If you want to use PHP to find image in your HTML, you can use following PHP script: 1 2 3 $htmlCode = ‘Some HTML with image <img src="/demo.jpg">’; preg_match("#<img(.*)src=(.*)>#i", $htmlCode, $match); echo $match[0];