DrupalBin
Submit Code
About
Recent Posts
css path
14 min 58 sec
ago
Fix for Code
4 hours 14 min
ago
Fix for Code
4 hours 20 min
ago
Fix for Code
4 hours 28 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for CSS wildcard mechanism
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
function _phptemplate_page($vars, $suggestions) { // CSS Files $css = array( 'admin/*' => 'admin', 'node/add/portfolio-entry' => 'add-portfolio', ); $newcss = array(); $wildcars = array(); foreach ($css as $match => $file) { if (strpos($match, '*') == strlen($match) - 1) { unset($css[$match]); $wildcards[substr($match, 0, -2)] = $file; } } foreach ($suggestions as $suggestion) { $suggestion = substr($suggestion, 5); if (isset($css[$_GET['q']])) { drupal_add_css(path_to_theme() .'/style-'. $css[$_GET['q']] .'.css', 'theme'); } foreach ($wildcards as $match => $file) { if (strpos($suggestion, $match) === 0) { drupal_add_css(path_to_theme() .'/style-'. $file .'.css', 'theme'); } } } $vars['styles'] = drupal_get_css(); return _phptemplate_default('page', $vars, $suggestions); }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.