News Feed
Jobs Feed
Sections



Recent Jobs

News Archive
feed this:

Thomas Weinert's Blog:
Highlight Words In HTML
May 10, 2010 @ 10:34:24

In the latest post to his blog Thomas Weinert takes a look at a simple challenge someone asked him about - highlighting a section of HTML based on a search string - and his solution.

The challenge is to wrap given words in text content with a span and add a class to the span depending on the word. Do not touch elements, attributes, comments or processing instructions. Do it case insensitive and do it the safe way.

He uses the FluentDOM tool to get the job done. It allows him to create an XPath expression to single out the item to be highlighted (in this case a single or series of words) and wrap them in a matching span tag with the correct styles attached.

0 comments voice your opinion now!
fluentdom tutorial highlight word



Thomas Weinert's Blog:
FluentDOM
June 12, 2009 @ 07:59:13

Thomas Weinert has posted about a new tool he's worked up to make working with the DOM in PHP a bit more fluent - FluentDOM.

Today I like to present a new projekt: FluentDOM. It provides an easy to use, jQuery like, fluent interface for DOMDocument. The idea was born in a workshop of Tobias Schlitt about the PHP XML extensions at the IPC Spring in Berlin.

He includes a basic code example - locating items with an ID of "first" and removing that ID to replace it with a class. If you'd like to check it out (literally) you can grab the latest version from the project's public svn.

0 comments voice your opinion now!
jquery xml dom fluentdom



Community Events





Don't see your event here?
Let us know!


database opinion api injection unittest community framework introduction zendframework2 phpunit release testing conference symfony2 language voicesoftheelephpant application podcast interview zendframework

All content copyright, 2012 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework