tmallen Posted February 5, 2008 Share Posted February 5, 2008 How can I pluck out all instances of, for example <div class="foo">...</div> with all enclosing code selected? I'm customizing phpBB to do specific code highlighting, in this case, for CSS. I'll assign each instance to a single array, foreach that (to process the code), and echo the "highlighted" HTML with a number of <spans>. Would this be any easier if I just had phpBB insert unique HTML comments for this BBCode instance, grabbing the contents with Regex? <!-- End CSS --> is easier to pick out than any of a number of </div>, but if PHP has a sense of XHTML open/close rules and nesting, I should be able to take the simpler approach. Quote Link to comment https://forums.phpfreaks.com/topic/89500-search-html-for-a-css-class-and-grab-tag-contents/ Share on other sites More sharing options...
tmallen Posted February 5, 2008 Author Share Posted February 5, 2008 Never mind, found a nice solution here. It's unfortunately JS-based, but seems to work well: http://code.google.com/p/syntaxhighlighter/ Quote Link to comment https://forums.phpfreaks.com/topic/89500-search-html-for-a-css-class-and-grab-tag-contents/#findComment-458427 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.