Tag Archive for template

XHTML 1.1 Web Standards Template — Fixed

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>title goes here » Site title here</title>

<base href="" />
<meta name="Author" content="#" />
<meta name="Description" content="#" />
<meta name="Copyright" content="#" />
<meta name="Robots" content="#" />
<meta name="Generator" content="#" />
<meta name="Keywords" content="#" />
<meta http-equiv="Expires" content="#" />
<meta http-equiv="Cache-Control" content="#" />
<meta http-equiv="imagetoolbar" content="false" />
<link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
<link href="/script/javascript.js" type="text/javascript"  />
<style type="text/css" xml:space="preserve">
/*<![CDATA[*/
@import url(/css/style.css) all;
/*]]>*/
</style>
<link rel="stylesheet" href="/css/screen.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="/css/print.css" type="text/css" media="print" />

<!--[if IE]>
<link rel="stylesheet" href="/css/win-ie-all.css" type="text/css" media="screen, projection" />
<![endif]-->

</head>
<body>

</body>
</html>

source

Drupal theming list Views to display like menus

<?php
function THEMENAME_views_view_list_VIEWNAME($view, $nodes, $type) {
foreach ($nodes as $node) {
$output .= "<li class='leaf'>" . l($node->node_title, "node/$node->nid") . "</li>
";
}

if ($output) {
return "<div class='menu'>
<ul>
" . $output . '</ul></div>';
}
}
?>

source

Menu items that are not links

<?php
function phptemplate_menu_item_link($item, $link_item) {
if ($item['path'] == '<none>') {
$attributes['title'] = $link['description'];
//  Here you can specify a '#' link or wathever you want:
//  return '<a'. drupal_attributes($attributes) . 'href="#">'. $item['title'] .'</a>';
return '<span'. drupal_attributes($attributes) .'>'. $item['title'] .'</span>';
}
else {
return l($item['title'], $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL);
}
}
?>
<?php
/*
* As a nice extra, we can also add additional help text to the menu item edit page. For that * you will need to implement a very small module that implements form_alter.
* The module itself doesn't need anything more than the following code snippet:
*/
function example_form_alter($form_id, &$form) {
if ('menu_edit_item_form' == $form_id) {
$form['path']['#description'] .= ' ' . t('Enter %none to have a menu item that generates no link.', array('%none' => '<none>'));
}
}
?>

source

Separate theme for a specific node

<?php
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'node':
$vars['template_files'] = array('node-'. $vars['nid']);
break;
}
return $vars;
}
?>

source

Customize search results

<?php
/**
* Theme override for search results.
*
* Replace themename with your theme's name.
*/
function themename_search_item($item, $type) {
$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
$output .= ' <dd>'. ($item['snippet'] ? '<p>'. $item['snippet'] .'</p>' : '');
return $output;
}
?>

source

Non collapsible advanced search

<?php
/**
* Theme override for search form.
*
* Replace themename with your theme's name.
*/
function themename_search_form($form) {
$output = '';
// Print out the $form array to see all the elements we are working with.
//$output .= dsm($form);
// Once I know which part of the array I'm after we can change it.

// You can use the normal Form API structure to change things, like so:
// Change the advanced search field to non collapsible.
$form['advanced']['#collapsible'] = 0;

// Make sure you call a drupal_render() on the entire $form to make sure you
// still output all of the elements (particularly hidden ones needed
// for the form to function properly.)
$output .= drupal_render($form);
return $output;
}
?>

source

Position Fixed Footer whitout JavaScript

#footer{
position:fixed;
left:0px;
bottom:0px;
height:20px;
width:100%;
background:#999;
}
/* For ie 6*/
* html #footer{
position:absolute;
top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}

source

Drupal 5.x page.tpl.php template

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">

<head>
<title><?php print $head_title ?></title>
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>
<script type="text/javascript"><?php /* Needed to avoid Flash of Unstyle Content in IE */ ?> </script>
</head>

<body>

<!-- logo -->
<?php if ($logo) { ?><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a><?php } ?>
<!-- site name -->
<?php if ($site_name) { ?><h1 class='site-name'><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></h1><?php } ?>
<!-- sloagan -->
<?php if ($site_slogan) { ?><?php print $site_slogan ?><?php } ?>

<!-- primary links -->
<?php if (isset($primary_links)) { ?><?php print theme('links', $primary_links, array('class' =>'links', 'id' => 'navlist')) ?><?php } ?>
<!-- secondary links -->
<?php if (isset($secondary_links)) { ?><?php print theme('links', $secondary_links, array('class' =>'links', 'id' => 'subnavlist')) ?><?php } ?>

<!-- search -->
<?php print $search_box ?>

<!-- header -->
<?php print $header ?>

<!-- mission -->
<?php if ($mission) { ?><?php print $mission ?><?php } ?>

<!-- breadcrumb -->
<?php print $breadcrumb ?>

<!-- content with headline and tabs -->
<h1 class="title"><?php print $title ?></h1>
<div class="tabs"><?php print $tabs ?></div>
<?php print $help ?>
<?php print $messages ?>
<?php print $content; ?>

<!-- sidebars -->
<?php if ($sidebar_left) { ?>
<?php print $sidebar_left ?>
<?php } ?>

<?php if ($sidebar_right) { ?>
<?php print $sidebar_right ?>
<?php } ?>

<!-- feed icon -->
<?php print $feed_icons; ?>

<!-- footer -->
<?php print $footer_message ?>

<!-- and finally close the document like this: -->

<?php print $closure ?>
</body>
</html>

source

Google Analytics ga.js Script

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("{0}");
pageTracker._initData();
pageTracker._trackPageview();
</script>

source

PureMVC XML DataProxy Class Template

/**
* Base PureMVC Project
*/
package model
{
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;

import org.puremvc.as3.interfaces.IProxy;
import org.puremvc.as3.patterns.proxy.Proxy;

import ApplicationFacade;

public class DataProxy extends Proxy implements IProxy
{
public static const NAME:String = "DataProxy";

public function DataProxy()
{
trace ("DataProxy instantiated");
/**
* Here, we initialize DataProxy with a var named "data"
* of type Object(), a built-in property of the Proxy class.
* This var will be used for storing data retrieved from the xml document.
*/
super( NAME, new Object() );

var loader:URLLoader = new URLLoader();
loader.addEventListener( Event.COMPLETE, onDataLoaded );
loader.load( new URLRequest( "data.xml" ) );

}

private function onDataLoaded( evt:Event ):void
{
trace ("DataProxy.onDataLoaded()");

var xml:XML = new XML( evt.target.data );
xml.ignoreWhitespace = true;

/**
* When DataProxy is done loading and parsing data, it
* sends an INITIALIZE_SITE notification back to the framework.
*/
sendNotification( ApplicationFacade.INITIALIZE_SITE );
}
}
}

source