Skip to content

Instantly share code, notes, and snippets.

@chrisjdavis
Created March 29, 2013 17:15
Show Gist options
  • Save chrisjdavis/5272200 to your computer and use it in GitHub Desktop.
Save chrisjdavis/5272200 to your computer and use it in GitHub Desktop.
foreach( $dom->find('h4') as $hs ) {
$slug = Utils::slugify( $hs->node->nodeValue );
$heading = $dom->get( $hs );
$heading->id = $slug;
}
@ringmaster
Copy link

    $dom = new HTMLDoc('<h4>test test</h4>');
    foreach( $dom->find('h4') as $h4 ) {
        $slug = Utils::slugify( $h4->node->nodeValue );
        $h4->id = $slug;
    }
    Utils::debug( $dom->get( ) );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment