User Profiles Version 1
am 11.10.2008 - 17:02 Uhr in
Hallo!
Bin gerade dabei ein Userprofil nach dem "User Profiles Version 1" tutorial
http://shellmultimedia.com/tutorials/user-profiles-version-1
von michelle zu erstellen.
Soweit, so gut.
Bin so gut wie fast fertig, habe aber ein kleines problem mit dem Einfügen der Codes in die Template.php. Benutze das Garaland standart template von drupal.
Immer wenn ich die Codes einfüge, kommt irgendein Fehler in einer Zeile. Bin schon fast am verzweifeln, wenn ich versuche den Fehler zu beseitigen, kommt er an einer neuen stelle...
hier mal den code, so wie ich ihn eingefügt habe nach dem Tutorial...:
momentaner error: Parse error: syntax error, unexpected $end in /var/www/web18/web/themes/garland/template.php on line 179
und: Fatal error: Cannot redeclare phptemplate_views_view_list_buddylist_of_uid() (previously declared in /var/www/web18/web/modules/advanced_profile/advanced_profile.module:436) in /var/www/web18/web/themes/garland/template.php on line 158
<?php
// $Id: template.php,v 1.4.2.1 2007/04/18 03:38:59 drumm Exp $
/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($sidebar_left, $sidebar_right) {
if ($sidebar_left != '' && $sidebar_right != '') {
$class = 'sidebars';
}
else {
if ($sidebar_left != '') {
$class = 'sidebar-left';
}
if ($sidebar_right != '') {
$class = 'sidebar-right';
}
}
if (isset($class)) {
print ' class="'. $class .'"';
}
}
/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
}
}
/**
* 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 '<div id="comments">'. $content . '</div>';
}
else {
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
}
}
/**
* Override or insert PHPTemplate variables into the templates.
*/
//function _phptemplate_variables($hook, $vars) {
// if ($hook == 'page') {
if (arg(0) == 'user') {
$vars['tabs'] = str_replace('Edit</a>', 'Edit Account</a>', $vars['tabs']);
}
// return $vars;
// }
//}
/**
* 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 .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
}
return $output;
}
// >>>>>>>>>>>>>>>>>AB HIER HAB ICH ALLES EINGEFÜGT!!!<<<<<<<<<<<<<<<<<<
// Override the display of the nodeprofile to just show the node itself and not the surrounding markup or the tabs.
// Theming of the nodeprofile will be handled separately. Note that this affects it wherever it is displayed and
// not only on the user page.
function phptemplate_nodeprofile_display_box($element, $content) {
$head = isset($element['#title']) ? '<h2 class="nodeprofile-title">'. check_plain($element['#title']) .'</h2>' : '';
return $content;
}
// Override the entire user account view page to not show the categories or to seperate items into divs.
// Note that this is set up to still show everything that is thrown on this page. Getting rid of non-nodeprofile
// sections is done in the node_profile_bonus module by unsetting them but could also be done here by conditionally
// printing them to begin with.
function phptemplate_user_profile($account, $fields) {
foreach ($fields as $category => $items) {
foreach ($items as $item) {
$output .= $item['value'] ;
}
}
// Returning nothing from this function causes the entire page to whitescreen, so let's put something in by default
// A better idea might be to load up some sort of standard thing that has the views and just not the profile fields
if (empty($output)) {
$output = "This user has not filled out a user profile.";
}
return $output;
}
//2
function phptemplate_views_view_list_buddylist_of_uid($view, $nodes, $type) {
$fields = _views_get_fields();
$taken = array();
// Set up the fields in nicely named chunks.
foreach ($view->field as $id => $field) {
$field_name = $field['field'];
if (isset($taken[$field_name])) {
$field_name = $field['queryname'];
}
$taken[$field_name] = true;
$field_names[$id] = $field_name;
}
// Set up some variables that won't change.
$base_vars = array(
'view' => $view,
'view_type' => $type,
);
foreach ($nodes as $i => $node) {
$vars = $base_vars;
$vars['node'] = $node;
$vars['count'] = $i;
$vars['stripe'] = $i % 2 ? 'even' : 'odd';
foreach ($view->field as $id => $field) {
$name = $field_names[$id];
$vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
if (isset($field['label'])) {
$vars[$name . '_label'] = $field['label'];
}
}
$items[] = _phptemplate_callback('views-list-buddylist_of_uid', $vars);
}
if ($items) {
//MAC Instead of returning an item list, we just seperate with spaces
//return theme('item_list', $items);
return implode(" ",$items);
}
}
//3
// These overrides load custom .tpl files to handle the guestbook display as a whole, a single entry display, and the input form
function phptemplate_guestbook($uid, $entries, $comment_entry, $limit = 20) {
return _phptemplate_callback('guestbook', array('uid'=>$uid, 'entries'=>$entries, 'comment_entry' => $comment_entry, 'limit' => 20));
}
function phptemplate_guestbook_entry($uid, $entry, $comment_entry = NULL, $confirm_delete = false) {
return _phptemplate_callback('guestbook-entry', array('uid'=>$uid, 'entry'=>$entry, 'comment_entry' => NULL, 'confirm_delete' => false));
}
function phptemplate_guestbook_form_entry_form($form) {
return _phptemplate_callback('guestbook-form-entry-form', array('form'=>$form));
}
//4
function phptemplate_node_form($form) {
if ($form['#node']->type == 'uprofile') {
return _phptemplate_callback('node-uprofile-edit', array('form' => $form));
}
else {
return theme_node_form($form);
}
}
- Anmelden oder Registrieren um Kommentare zu schreiben
Neue Kommentare
vor 1 Tag 1 Stunde
vor 1 Tag 1 Stunde
vor 5 Tagen 19 Stunden
vor 5 Tagen 21 Stunden
vor 5 Tagen 21 Stunden
vor 5 Tagen 21 Stunden
vor 6 Tagen 19 Stunden
vor 6 Tagen 21 Stunden
vor 1 Woche 17 Stunden
vor 1 Woche 1 Tag