ok this is not pretty and prob doesn’t work but i hope it helps.
Say you have created a blog using Codeigniter. And you use the typography helper to format the main body of text. All is working well untill you decide to add a youtube video.
You have to add this code into the copy to get a youtube video
// example youtube embed code
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/a0qMe7Z3EYg&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/a0qMe7Z3EYg&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>
now when the typography help is in use it adds p tags all over the place
//example youtube code run through auto_typography_helper
<object width="425" height="344"><p><param name="movie" value="http://www.youtube.com/v/a0qMe7Z3EYg&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></p></param><embed src="http://www.youtube.com/v/a0qMe7Z3EYg&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></p></embed></object></p>
So i thought would it be an idea to have a config file you can add extra elements to the helpers elements list.
//typography helper extract
class Auto_typography {
// Block level elements that should not be wrapped inside <p> tags
var $block_elements = 'div|blockquote|pre|code|h\d|script|ol|ul';
// Elements that should not have <p> and <br /> tags within them.
var $skip_elements = 'pre|ol|ul';
// Tags we want the parser to completely ignore when splitting the string.
var $ignore_elements = 'a|b|i|em|strong|span|img|li';
something like this to allow you have a config file to add more
class Auto_typography {
// Block level elements that should not be wrapped inside <p> tags
var $block_elements = 'div|blockquote|pre|code|h\d|script|ol|ul';
// Elements that should not have <p> and <br /> tags within them.
var $skip_elements = 'pre|ol|ul';
// Tags we want the parser to completely ignore when splitting the string.
var $ignore_elements = 'a|b|i|em|strong|span|img|li';
// checks weather config file is loaded if so then add the extra stuff
$CI =& get_instance();
if ($CI->config->item('typography_config'))
{
// add the extras if there are any
$this->block_elements .= '|'.$this->CI->config->item('typography_block');
$this->skip_elements .= '|'.$this->CI->config->item('typography_skip');
$this->ignore_elements .= '|'.$this->CI->config->item('typography_ignore');
}
and the config file could look like this
//just an example
$config['block_elements'] ="object|param|embed";
$config['skip_elements'] ="object|param|embed";
$config['ignore_elements'] = 'object|param|embed';
This would help with flash and anything else you wanted to embed into the page
Now the code above is by no means working or great but i hope it gets my idea accross a little better.
If it isn’t right then i’m sorry for wasting time.