<?php $vid = 4; /* <---- put correct vocabulary ID here */ $terms = taxonomy_get_tree($vid); print "<ul>"; foreach ( $terms as $term ) { //echo '<pre>'; print_r($term); echo '</pre>'; if(taxonomy_term_count_nodes($term->tid)) { print "<li>". l($term->name,'taxonomy/term/'.$term->tid, array('title' => $term->name)). "</li>"; } /* end foreach */ } print "</ul>"; ?>
du -ch repo | grep 'total'
function convert_to_money( $s, $dec=2 ) { // converts a string / number to float $f = floatval( $s ); if( $f<0 ): // if negative $p = array( '($', ')' ); // formatting negative numbers $f = str_replace( '-', '', $f ); // removes the minus sign else: // positive no. $p = array( '$', NULL ); endif; return $p[0].number_format( $f, $dec ).$p[1]; }
find . -name *.DS_Store -type f -exec rm {} \;echo hi > file.txt
single ‘>’ replaces file
echo hi >> file.txt
double ‘>>’ appends to file
somecommandthatmakeserrors 2> error_log.txt
// remove colons from form labels template.php function phptemplate_form_element() { $arg = arg(); $args = func_get_args(); return preg_replace('@(\.*):\s*(<span.*?>.*?</span>)?\s*(</label>)@i', '$1$2$3', call_user_func_array('theme_form_element', $args)); }
cat file-list.txt | xargs tar rvf archive.tar
find . -name '*.html' > ~/Desktop/filecountmm.txt
function phptemplate_body_class($left, $right) { if ($left != '' && $right != '') { $class = 'sidebars'; } else { if ($left != '') { $class = 'sidebar-left'; } if ($right != '') { $class = 'sidebar-right'; } } if (isset($class) && arg(0) == 'admin') { $class .= " admin"; } elseif (arg(0) == 'admin') { $class = "admin"; } if (isset($class)) { print ' class="' . $class . '"'; } }