Joined October 2012
·

Jonathan Goode

Software Development Lead at University of Aberdeen
·
United Kingdom
·
·

Posted to Simple gulp starter over 1 year ago

I've recently integrated gulp into the workflow we use in our development team at work and as such I have created a gulp-starter GitHub repo (albeit a little advanced) which might be of interest to you: https://github.com/uofa/gulp-starter

@ryanartecona
I ended up using XPath.

$html = file_get_contents($filename);
$dom = new DOMDocument();
@$dom->loadHtml($html);
$xpath = new DOMXPath($dom);
$entries = $xpath->query("//a[not(img) and not(contains(concat(' ', @class, ' '), ' standard_link '))]");

if($entries->length > 0){
    echo '<ul><li style="font-weight: bold;">' . $filename . '</li><ol>';
}

foreach ($entries as $entry) {
    $array[] = $dom->saveHTML($entry);
}

if(isset($array))
    foreach($array as $value)
        echo '<li>' . htmlspecialchars($value) . '</li>';           

echo '</ol></ul>';
Posted to Reset a form over 1 year ago

You'd use my function if you already had a populated form where textboxes had values and checkboxes were checked (with the attribute set) and you wanted to reset those to be blank and unchecked.

First of all, thank you. I've changed it to look for links/anchors that are missing a class attribute.

<a(\s(?!class)([\w-])+=([\"\'])[^\"\']+\3)\s*\/?>

-Could it be extended to look for links/anchors missing a particular class such as 'standard_link'? The problem is further complicated by the fact that there could be multiple classes defined. I know regex shouldn't really be used with html but I want to use it with the program grepwin to look through my PHP code to make sure I've added a class to all my links.

Achievements
87 Karma
2,843 Total ProTip Views
Interests & Skills