Hi CrazyDave, > @AD7Six, I'm still not clued up enough on behaviours to start creating > my own. It'd help if the cakephp book had some information on > creating them and an example http://book.cakephp.org/view/88/behaviors > > Also the content being saved shouldn't ever be edited so I figured > using Geshi before saving it would lower the overhead of doing it > every time it's displayed. Other content which can be edited uses > Mark Story's Geshi Helper ;)
Take a look at the textile behaviour - http://wiki.kabturek.info/textile_behavior - I think this would match up perfectly for what you're doing. If you are saving the text to be "Geshi'd" in a column called 'content', I would add a new column to the DB called 'geshi_content'. Then, in your behaviour's beforeSave you convert the data in $this->data[$model]['content'] with Geshi and place the converted data in $this->data[$model]['geshi_content']. This way, you don't have to use the helper to convert the copy every time it's requested, but it can still be edited easily because you've stored the plain text version. Also, by packaging up as a behaviour, you only need to add a prefixed field to ANY table to add syntax highlighting, making it very reusable! hth jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
