Part of the EllisLab Network
   
 
typography_helper to have its set of checks in a config file
Posted: 10 July 2008 12:18 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  75
Joined  08-09-2007

I think it would be great if you could set the typography_helpers check values in a config file.

So you could add

object param etc without having to overwrite the entire file.

so things like youtube and flash players wont get messed up if added by a user.

Unless there is a better way. If there is please delete this

Profile
 
 
Posted: 10 July 2008 08:57 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6593
Joined  03-23-2006

Could you elaborate a bit more?  Maybe give some pseudo-code?  Have you found any flash/youtube/quicktime scripts in the wiki or other community sites that you think would be worthwhile?

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 11 July 2008 03:14 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  75
Joined  08-09-2007

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.

Profile
 
 
Posted: 11 July 2008 06:34 AM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6593
Joined  03-23-2006

I understand.  In these cases, I think probably extending the autotypography helper locally is the best bet.  It is meant to be a convenience, but can’t cover every possible use.  That said though, I appreciate this a lot, and if you end up adding the ability to config it, I’d be most interested in seeing your solution.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 11 July 2008 06:45 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  75
Joined  08-09-2007

Thanks for the reply, and thanks for taking the time to hear me out. really appreciate it.

Profile
 
 
Posted: 11 July 2008 06:48 AM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6593
Joined  03-23-2006

Not at all.  Thanks for taking the time to share your ideas with us.  Look forward to seeing if they develop, but even if not this has been useful and interesting.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 62600 Total Logged-in Users: 22
Total Topics: 77073 Total Anonymous Users: 0
Total Replies: 416278 Total Guests: 150
Total Posts: 493351    
Members ( View Memberlist )
Newest Members:  eudj1nsehartEasyMLance SloanandrewjhscottShuvopatricovghazalravi_ghostblade_kaqfa