dnsmasq can be used to setup wildcard subdomains like *.example.com to properly direct them to the same ip on a local development workstation.
If you have an alias called “my_content” for node/13, than when you edit the node, my_content dissapears. This module gets rid of this functionality, fully hiding the original path.
Also can be used for aliased views with arguments.
Or custom node menu tabs, that need to be aliased.
<?php function theme_modulename_extra_checkboxes_in_grid($element) { $output = '<div class="form-item"><div class="form-checkboxes">'; // Wrapping each third checkbox into a div $count = 0; $wrapper_open = '<div class="grid-wrapper">'; $wrapper_close = '</div>'; $output .= $wrapper_open; foreach ($element['value']['#options'] as $key => $value) { $count++; $output .= drupal_render($element['value'][$key]); if (3 == $count) { $output .= $wrapper_close . $wrapper_open; $count = 0; } } $output .= $wrapper_close; $output .= '</div></div>'; return $output; } ?>
Drupal.behaviors.SomeBehaviourName = function() { alert("It works!"); };
<?php function themename_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) { global $pager_page_array, $pager_total; $quantity = 4; // Calculate various markers within this pager piece: // Middle is used to "center" pages around the current page. $pager_middle = ceil($quantity / 2); // current is the page we are currently paged to $pager_current = $pager_page_array[$element] + 1; // first is the first page listed by this pager piece (re quantity) $pager_first = $pager_current - $pager_middle + 1; // last is the last page listed by this pager piece (re quantity) $pager_last = $pager_current + $quantity - $pager_middle; // max is the maximum page number $pager_max = $pager_total[$element]; // End of marker calculations. // Prepare for generation loop. $i = $pager_first; if ($pager_last > $pager_max) { // Adjust "center" if at end of query. $i = $i + ($pager_max - $pager_last); $pager_last = $pager_max; } if ($i <= 0) { // Adjust "center" if at start of query. $pager_last = $pager_last + (1 - $i); $i = 1; } // End of generation loop preparation. $li_first = theme('pager_first', (isset($tags[0]) ? $tags[0] : t('« first')), $limit, $element, $parameters); $li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('‹ previous')), $limit, $element, 1, $parameters); $li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('next ›')), $limit, $element, 1, $parameters); $li_last = theme('pager_last', (isset($tags[4]) ? $tags[4] : t('last »')), $limit, $element, $parameters); if ($pager_total[$element] > 1) { if ($li_first) { $items[] = array( 'class' => 'pager-first', 'data' => $li_first, ); } if ($li_previous) { $items[] = array( 'class' => 'pager-previous', 'data' => $li_previous, ); } // When there is more than one page, create the pager list. if ($i != $pager_max) { if ($i > 1) { $items[] = array( 'class' => 'pager-ellipsis', 'data' => '…', ); } // Now generate the actual pager piece. for (; $i <= $pager_last && $i <= $pager_max; $i++) { if ($i < $pager_current) { $items[] = array( 'class' => 'pager-item', 'data' => theme('pager_previous', $i, $limit, $element, ($pager_current - $i), $parameters), ); } if ($i == $pager_current) { $items[] = array( 'class' => 'pager-current', 'data' => $i, ); } if ($i > $pager_current) { $items[] = array( 'class' => 'pager-item', 'data' => theme('pager_next', $i, $limit, $element, ($i - $pager_current), $parameters), ); } } if ($i < $pager_max) { $items[] = array( 'class' => 'pager-ellipsis', 'data' => '…', ); } } // End generation. if ($li_next) { $items[] = array( 'class' => 'pager-next', 'data' => $li_next, ); } if ($li_last) { $items[] = array( 'class' => 'pager-last', 'data' => $li_last, ); } // We call our additional theming function to display the pager $additional['tags'] = $tags; $additional['limit'] = $limit; $additional['element'] = $element; $additional['parameters'] = $parameters; $additional['max'] = $pager_max; return themename_notice_pager($items, $additional); } } function themename_notice_pager($items, $additional) { global $pager_page_array; $output = ''; foreach ($items as $key => $item) { // Unsetting the next and previous values, because we output them explicitly later on if (in_array($item['class'], array('pager-next', 'pager-previous'))) { unset($items[$key]); continue; } // Unsetting the first and last values if they already displayed, so the below code with replacements doesn't fire. Hard to explain. T_T if ($item['class'] == 'pager-first') { $matches = array(); $matches2 = array(); preg_match("/<a.+?href=\"(.+?)\"/", $items[$key + 2]['data'], $matches); preg_match("/<a.+?href=\"(.+?)\"/", $item['data'], $matches2); if ($matches[1] == $matches2[1]) { unset($items[$key]); continue; } } if ($item['class'] == 'pager-last') { $matches = array(); $matches2 = array(); preg_match("/<a.+?href=\"(.+?)\"/", $items[$key - 2]['data'], $matches); preg_match("/<a.+?href=\"(.+?)\"/", $item['data'], $matches2); if ($matches[1] == $matches2[1]) { unset($items[$key]); continue; } } // We need to replace the first item with a number instead of the word 'first' if ($item['class'] == 'pager-first') { $items[$key]['class'] = 'pager-item'; $items[$key]['data'] = preg_replace("/(<a.+?>)(.+?)(<\/a>)/", '${1}1$3', $items[$key]['data']); continue; } // We need to replace the last item with a number instead of the word 'last' if ($item['class'] == 'pager-last') { $items[$key]['class'] = 'pager-item'; $items[$key]['data'] = preg_replace("/(<a.+?>)(.+?)(<\/a>)/", '${1}'. $additional['max'] .'$3', $items[$key]['data']); continue; } // Wrapping the currently active pager link into an actual anchor if ($item['class'] == 'pager-current') { $items[$key]['data'] = '<a href="#" class="choice">'. $item['data'] .'</a>'; } } // Displaying explicitly previous link $page_new = pager_load_array($pager_page_array[$additional['element']] - 1, $additional['element'], $pager_page_array); $output .= theme( 'pager_link', (isset($additional['tags'][1]) ? $additional['tags'][1] : t('previous')), $page_new, $additional['element'], $additional['parameters'], array('class' => 'link_back') ); // Generating items $output .= '<div class="pager_middle"><p>'. t('Page:') .'</p> <span>|</span>'. "\n"; foreach ($items as $item) { $output .= $item['data'] ."\n<span>|</span>\n"; } $output .= '</div>'; // Displaying explicitly next link $page_new = pager_load_array($pager_page_array[$additional['element']] + 1, $additional['element'], $pager_page_array); $output .= theme( 'pager_link', (isset($additional['tags'][2]) ? $additional['tags'][2] : t('next')), $page_new, $additional['element'], $additional['parameters'], array('class' => 'link_next') ); return $output; } ?>
<?php /** * Preprocess theme function to print a single record from a row, with fields */ function themename_preprocess_views_view_summary(&$vars) { $view = $vars['view']; $argument = $view->argument[$view->build_info['summary_level']]; $url_options = array(); if (!empty($view->exposed_raw_input)) { $url_options['query'] = $view->exposed_raw_input; } $vars['classes'] = array(); foreach ($vars['rows'] as $id => $row) { $vars['rows'][$id]->link = $argument->summary_name($row); $args = $view->args; $args[$argument->position] = $argument->summary_argument($row); // Custom changes in default code // Managing the 2 arguments to work with each other, so the block attachments filter the main view correctly. if ($view->name == 'member_dashboard') { if ($argument->name_alias == 'term_data_name') { $arg = arg(1); if (empty($arg)) { $arg = 'all'; } array_unshift($args, $arg); } } $vars['rows'][$id]->url = url($view->get_url($args), $url_options); $vars['rows'][$id]->count = intval($row->{$argument->count_alias}); if ($vars['rows'][$id]->url == base_path() . $_GET['q'] || $vars['rows'][$id]->url == base_path() . drupal_get_path_alias($_GET['q'])) { $vars['classes'][$id] = 'active'; } } } ?>
<?php function themename_preprocess_page(&$variables) { global $user; // Added two types of template suggestions for pages based on node type. if (!empty($variables['node']->type)) { $variables['template_files'][] = "page-node-" . $variables['node']->type; } if (arg(0) == 'node' && arg(1) == 'add') { $variables['template_files'][] = "page-node-" . arg(2) .'-add'; } } ?>
<?php /** * Implementation of hook_breadcrumb(). */ function themename_breadcrumb($breadcrumb) { $breadcrumb[] = '<span class="act_crumb">'. t(menu_get_active_title()) .'</span>'; $output = '<p>' . t('Home: ') . '</p>'; if (!empty($breadcrumb)) { $output .= implode('<span>›</span>', $breadcrumb); } return $output; } ?>
<?php /** * Generates IE CSS links for LTR and RTL languages. */ function themename_get_ie_styles() { $iecss = '<!--[if IE 8]> <link rel="stylesheet" href="'. base_path() . path_to_theme() .'style/ie8fix.css" type="text/css" /> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" href="'. base_path() . path_to_theme() .'style/ie7fix.css" type="text/css" /> <![endif]--> <!--[if IE 6]> <link rel="stylesheet" href="'. base_path() . path_to_theme() .'style/ie6fix.css" type="text/css" /> <![endif]-->'; return $iecss; } ?>