I'll add some code snippets here that could help with a drupal website.
NB: This is for your custom theme, DO NOT add to one of the Drupal themes eg Garland. If you want to add a class to each page add this to the <body> tag of page.tpl.php:
{syntaxhighlighter brush: php;fontsize: 100; first-line: 1; }<?php // Add a class depending on the page if (module_exists('path')) { $alias = drupal_get_path_alias($_GET['q']); $class = explode('/', $alias); print 'class="page page-'.$class[0].'" '; } ?>{/syntaxhighlighter}
In the node.tpl.php file in your theme change
{syntaxhighlighter brush: php;fontsize: 100; first-line: 1; }<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">{/syntaxhighlighter}
to
{syntaxhighlighter brush: php;fontsize: 100; first-line: 1; }<div id="node-<?php print $node->nid; ?>" class="<?php print ($teaser ? 'node-teaser' : 'node'); ?><?php if ($sticky&&$page == 0) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?> clear-block <?php if ($page == 0) { ?>node-in-list<?php }; ?>">{/syntaxhighlighter}
NB: This is for your custom theme, DO NOT add to one of the Drupal themes eg Garland. Show all the vars in the main array, but only for the user 1 (super user). Just drop the following into your node.tpl.php
{syntaxhighlighter brush: php;fontsize: 100; first-line: 1; }<?php global $user; if($user->uid == 1) { print '<pre>'; print_r(get_defined_vars()); print '</pre>'; } ?>{/syntaxhighlighter}
NB: This is for your custom theme, DO NOT add to one of the Drupal themes eg Garland. If you want to shorten a string and add an elipse to the end use this php function in your templeate.tpl.php and call it on anything
{syntaxhighlighter brush: php;fontsize: 100; first-line: 1; }function myTruncate($string, $limit, $break=".", $pad="...") { if(strlen($string) <= $limit) return $string; if(false !== ($breakpoint = strpos($string, $break, $limit))) { if($breakpoint < strlen($string) - 1) { $string = substr($string, 0, $breakpoint) . $pad; } } return $string; }{/syntaxhighlighter}
Thanks to CCS Tricks for this one
Contact me here or catch me on one of
the social networks below
Try this on your mobile
You should be able to use this right from the screen
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
|
|
|
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
|
Copyright David Slack - Web developer