//************* start - section 1 ************************
//************* start - user_profile.tpl.php ************************
Hello Dojo
uid);
while ($node = db_fetch_object($result)) {
print '
'. $node->title .'
';
}
?>
This is normal html
$items) {
if (strlen($category) > 0) {
$output .= '
'. $category .'
';
}
$output .= '
';
foreach ($items as $item) {
if (isset($item['title'])) {
$output .= '- '. $item['title'] .'
';
}
$output .= '- '. $item['value'] .'
';
}
$output .= '
';
}
$output .= '
';
print $output;
?>
//************* end - user_profile.tpl.php ************************
//************* start - template.php ************************
'. implode(' ', $breadcrumb) .'';
}
}
/**
* Allow themable wrapping of all comments.
*/
function phptemplate_comment_wrapper($content, $type = null) {
static $node_type;
if (isset($type)) $node_type = $type;
if (!$content || $node_type == 'forum') {
return '';
}
else {
return '';
}
}
/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {
if ($secondary = menu_secondary_local_tasks()) {
$output = '';
$output .= "\n";
$vars['tabs2'] = $output;
}
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
return $vars;
}
return array();
}
/**
* Returns the rendered local tasks. The default implementation renders
* them as tabs.
*
* @ingroup themeable
*/
function phptemplate_menu_local_tasks() {
$output = '';
if ($primary = menu_primary_local_tasks()) {
$output .= "\n";
}
return $output;
}
function phptemplate_hello_world($title) {
print 'Hello World! I\'m a special page, called ' . $title . '';
};
function phptemplate_username($object) {
if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) .'...';
}
else {
$name = $object->name;
}
if (user_access('access user profiles')) {
$output = check_plain($name) . ' ('. l('contact', 'user/'. $object->uid . '/contact', array('title' => t('contact this user.'))).')';
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if ($object->homepage) {
$output = l($object->name, $object->homepage);
}
else {
$output = check_plain($object->name);
}
$output .= ' ('. t('not verified') .')';
}
else {
$output = variable_get('anonymous', t('Anonymous'));
}
return $output;
}
/**
* Catch the theme_profile_profile function, and redirect through the template api
*/
function phptemplate_user_profile($account, $fields = array()) {
// Pass to phptemplate, including translating the parameters to an associative array. The element names are the names that the variables
// will be assigned within your template.
/* potential need for other code to extract field info */
return _phptemplate_callback('user_profile', array('account' => $account, 'fields' => $fields));
}
//************* end - template.php ************************
//*********************************************************
//************* end - section 1 ***************************
//*********************************************************
//************* start - section 2 ***************************
//************* start - user_profile.tpl.php ****************
Hello Dojo
This is normal html
$items) {
if ($category != 'History') {
if (strlen($category) > 0) {
$output .= '
'. $category .'
';
}
$output .= '
';
foreach ($items as $item) {
if (isset($item['title'])) {
$output .= '- '. $item['title'] .'
';
}
$output .= '- '. $item['value'] .'
';
}
$output .= '
';
}
}
$output .= '
';
print $output;
?>
//************* end - user_profile.tpl.php ***************************
//************* start - template.php ***************************
function phptemplate_user_profile($account, $fields = array()) {
// Pass to phptemplate, including translating the parameters to an associative array. The element names are the names that the variables
// will be assigned within your template.
/* potential need for other code to extract field info */
$result = db_query('SELECT title FROM {node} WHERE uid = %d', $account->uid);
while ($node = db_fetch_object($result)) {
$my_nodes[] = $node->title;
}
return _phptemplate_callback('user_profile', array('account' => $account, 'fields' => $fields, 'my_nodes' => $my_nodes));
}
//************* end - template.php *****************************
//************* end - section 2 ********************************
//*********************************************************
//************* start - section 3 ***************************
/**
* There are 4 pieces to this template. The first is a piece that goes into template.php. The other 3 are different
* .tpl.php files that make up the pieces -- they are broken out due to the looping nature.
*/
//************* start - template.php *****************************
// merlinofchaos refactorying
/**
* Catch the theme_profile_profile function, and redirect through the template api
*
* we're going to use THREE .tpl.php files here.
*
*/
function phptemplate_user_profile($account, $fields = array()) {
$vars = array(
'account' => $account,
'fields' => $fields,
'picture' => theme('user_picture', $account),
'categories' => '',
);
// Extract each field into its own template.
foreach ($fields as $category => $items) {
$vars['category'] = $category;
$vars['items'] = ''; // reset this variable!
foreach ($items as $item) {
// we could use array_merge here but I'm putting them all in for
// clarity of what variables we have available.
$vars['title'] = $item['title'];
$vars['class'] = $item['class'];
$vars['value'] = $item['value'];
// run the item template
$vars['items'] .= _phptemplate_callback('user_profile_item', $vars);
}
// Now that we have all the items, run it through our category template.
$vars['categories'] .= _phptemplate_callback('user_profile_category', $vars);
}
// And put it all in the final wrapper.
return _phptemplate_callback('user_profile', array('vars' => $vars));
}
//************* end - template.php *****************************
/** ------------------------ **/
/* user_profile.tpl.php */
/** ------------------------ **/
/* user_profile_category.tpl.php */
0): ?>
/** ------------------------ **/
/* user_profile_item.tpl.php */
//************* end - section 3 ***************************
//*********************************************************