Zurück   WordPress Deutschland Forum > Support > Plugins und Widgets

Antwort
 
Themen-Optionen Ansicht
Alt 13.05.2008, 23:34   #1 (permalink)
PostRank: 1
 
Benutzerbild von allucinox
 
Registriert seit: 28.12.2007
Ort: Zürich, Schweiz
Beiträge: 43
Besucherzähler, kleine techn. Frage

Hi

Ich hab von Tamagothi den 'Besucherzähler' installiert. Nun ist es so, dass dieses Widget nicht mit meinem Theme 'i3Theme' funktioniert. Leider ist es so, dass es genau das ist, was ich brauche.

Auf meiner HP sieht ihr den aktuellen Stand und bin total unzufrieden. Ich hab an Tamagothi auch schon geschrieben. Leider (das zweite Mal) ohne Erfolg.

Kann mir jemand sagen, was ich ändern muss, damit der Besucherzähler genau so aussieht wie die anderen Widget auf meiner Page ?

Besten Dank
__________________
http://www.piball.ch
allucinox ist offline   Mit Zitat antworten
Alt 14.05.2008, 14:51   #2 (permalink)
PostRank: 9
 
Benutzerbild von Ammaletu
 
Registriert seit: 14.07.2007
Beiträge: 1.429
Zitat:
Kann mir jemand sagen, was ich ändern muss, damit der Besucherzähler genau so aussieht wie die anderen Widget auf meiner Page ?
Du müsstest dafür sorgen, dass das HTML des neuen Widgets mit dem der schon vorhandenen Widgets übereinstimmt. Im Moment besteht Deine Sidebar offenbar aus divs mit h3-Tags als Überschrift. Das neue Widget liegt aber in einem li mit einem h2-Tag als Überschrift.

Wenn ich mich mühsam dran erinnere, wie die Widgets funktionieren, dann sollte das eigentlich ja nicht passieren. Würde das nicht das Theme setzen, wenn nicht der Standard verwendet werden soll?! Da gibt es Variablen für "before widget", "after widget", "before headline" und "after headline". Entweder Dein Theme baut an der Stelle also Mist oder das Plugin nutzt nicht die vorgesehenen Strukturen. Hast Du mal einen Link zu beidem, dann kann ich genauer schauen, woran es liegt.
__________________
"Life brings hope and pain, but revenge never brings redemption." || Mein Blog
Ammaletu ist offline   Mit Zitat antworten
Alt 14.05.2008, 15:08   #3 (permalink)
WPD-Team
 
Benutzerbild von codestyling
 
Registriert seit: 30.03.2008
Ort: Leipzig
Beiträge: 999
statt
Code:
<li><h2>Besucher-Zähler</h2>
<p><span class="visitorcount">3412</span> Besucher</p></li>
lieber so
Code:
  <div class="dbx-box dbx-box-open"><h3 class="dbx-handle dbx-handle-cursor">Besucher-Zähler</h3>
<div class="dbx-content"><span class="visitorcount">3411</span> Besucher</div></div>
Dann bekommst du es etwa so wie im Bild
Angehängte Grafiken
Dateityp: jpg boxing.jpg (43,1 KB, 12x aufgerufen)
codestyling ist offline   Mit Zitat antworten
Alt 14.05.2008, 16:39   #4 (permalink)
PostRank: 1
 
Benutzerbild von allucinox
 
Registriert seit: 28.12.2007
Ort: Zürich, Schweiz
Beiträge: 43
und wo finde ich diese codes ? die kann ich ja einfach ersetzen, oder ?
__________________
http://www.piball.ch
allucinox ist offline   Mit Zitat antworten
Alt 14.05.2008, 17:53   #5 (permalink)
WPD-Team
 
Benutzerbild von codestyling
 
Registriert seit: 30.03.2008
Ort: Leipzig
Beiträge: 999
Dein "Tamagothi 'Besucherzähler'" muß das ausgeben, schätze mal, der wird von dir irgendwo eingebunden worden sein oder ist als Widget geschrieben. Ohne Quelle des Zählers kann man nicht viel mehr machen, als dir zu sagen, das dies dort zu modifizieren ist.
codestyling ist offline   Mit Zitat antworten
Alt 14.05.2008, 23:59   #6 (permalink)
PostRank: 1
 
Benutzerbild von allucinox
 
Registriert seit: 28.12.2007
Ort: Zürich, Schweiz
Beiträge: 43
Hi

Ja ich hab den Widget...aber soll ich es unter den Plugin ändern ?
__________________
http://www.piball.ch
allucinox ist offline   Mit Zitat antworten
Alt 15.05.2008, 00:05   #7 (permalink)
PostRank: 1
 
Benutzerbild von allucinox
 
Registriert seit: 28.12.2007
Ort: Zürich, Schweiz
Beiträge: 43
so sieht ja der code aus (plugin):


<?php

/*
Plugin Name: Visitor Counter Widget
Plugin URI: Lumières dans la nuit » Wordpress-Widget: Besucherzähler
Description: A simple visitor counter for WordPress. It is a simple widget I missed in the plugin databases.
Author: Elias Schwerdtfeger
Version: 1.1
Author URI: Lumières dans la nuit
*/



/*
** Copyright 2007 Elias Schwerdtfeger Lumières dans la nuit
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/


load_plugin_textdomain('visitorcounter', 'wp-content/plugins/visitorcounter');


if(!function_exists('get_ipaddress')) {
function get_ipaddress() {
if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$ip_address = $_SERVER["REMOTE_ADDR"];
} else {
$ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
if(strpos($ip_address, ',') !== false) {
$ip_address = explode(',', $ip_address);
$ip_address = $ip_address[0];
}
return $ip_address;
}
}


function wpvc_remove_oldentries ($var)
{
global $wpvc_global_keepfrom;
return $var > $wpvc_global_keepfrom;
}


function wpvc_count ($p_keepfor)
{
global $wpvc_global_keepfrom;
$now_ip = get_ipaddress ();
$now_time = time ();
$keepfor = $p_keepfor ? $p_keepfor : get_option ('visitorcounter_keepfor');
$count = get_option ('visitorcounter_count');
$array = get_option ('visitorcounter_blocked');
if ($count == FALSE)
{
$count = 0;
}
if ($keepfor == FALSE)
{
$keepfor = 10 * 60;
}
if ($array == FALSE)
{
$array = array ();
}
$wpvc_global_keepfrom = $now_time - $keepfor;
$array = array_filter ($array, 'wpvc_remove_oldentries');
if (!array_key_exists ($now_ip, $array))
{
$count++;
update_option ('visitorcounter_count', $count);
$array[$now_ip] = $now_time;
update_option ('visitorcounter_blocked', $array);
}
return $count;
}


function wpvc_sidebar_count ($title = FALSE, $before = FALSE, $after = FALSE, $showtitle = FALSE, $listitem = FALSE, $keepfor = 600)
{
$count = wpvc_count ($keepfor);
if (!$title)
{
$title = __('Counter', 'visitorcounter');
}
if (!$after)
{
$after = __('Visitors', 'visitorcounter');
}
echo '<li>';
if ($showtitle)
{
echo '<h2>' . stripslashes($title) . "</h2>\n";
}
echo $listitem ? '<ul><li>' : '<p>';
if ($before)
{
echo stripslashes($before) . ' ';
}
echo "<span class=\"visitorcount\">$count</span>";
if ($after)
{
echo ' ' . stripslashes($after);
}
echo $listitem ? '</li></ul>' : '</p>';
echo "</li>\n";
}


function wpvc_sidebar_widget ()
{
$opt = get_option ('visitorcounter_widget_options');
wpvc_sidebar_count ($opt['title'], $opt['before'], $opt['after'], $opt['showtitle'], $opt['listitem']);
}


function wpvc_widget_options ()
{
$opt = get_option ('visitorcounter_widget_options');
$cnt = get_option ('visitorcounter_count');
$kf = get_option ('visitorcounter_keepfor');
if (!is_array ($opt))
{
$opt = array (
'title' => __('Counter', 'visitorcounter'),
'before' => '',
'after' => __('Visitors', 'visitorcounter'),
'showtitle' => 1,
'listitem' => 0
);
}
if (!$cnt)
{
$cnt = 0;
}
if (!kf)
{
$kf = 600;
}
if ($_POST['visitorcounter_submit'])
{
$opt['title'] = $_POST['visitorcounter_title'];
$opt['before'] = $_POST['visitorcounter_before'];
$opt['after'] = $_POST['visitorcounter_after'];
$opt['showtitle'] = $_POST['visitorcounter_showtitle'];
$opt['listitem'] = $_POST['visitorcounter_listitem'];
$cnt = intval ($_POST['visitorcounter_count']);
$kf = intval ($_POST['visitorcounter_keepfor']);
update_option ('visitorcounter_widget_options', $opt);
if ($cnt > 0 && $cnt != $_POST['visitorcounter_oldcount'])
{
update_option ('visitorcounter_count', $cnt);
}
update_option ('visitorcounter_keepfor', $kf);
}
?>
<p style="text-align:left">
<label
for="visitorcounter_title"
title="<?php _e('This text will appear as widget title in the sidebar, if you activate the option for displaying the title.', 'visitorcounter'); ?>"
><?php _e('Widget Title:', 'visitorcounter'); ?></label><br />
<input
style="width:100%"
type="text"
id="visitorcounter_title"
name="visitorcounter_title"
value="<?php echo htmlspecialchars (stripslashes ($opt['title'])); ?>"
title="<?php _e('This text will appear as widget title in the sidebar, if you activate the option for displaying the title.', 'visitorcounter'); ?>"
/>
</p>
<p style="text-align:left">
<label
for="visitorcounter_before"
title="<?php _e('This text will appear before the number of visitors', 'visitorcounter'); ?>"
><?php _e('Text before the count (with HTML markup):', 'visitorcounter'); ?></label><br />
<input
style="width:100%"
type="text"
id="visitorcounter_before"
name="visitorcounter_before"
value="<?php echo htmlspecialchars (stripslashes ($opt['before'])); ?>"
title="<?php _e('This text will appear before the number of visitors', 'visitorcounter'); ?>"
/>
</p>
<p style="text-align:left">
<label
for="visitorcounter_after"
title="<?php _e('This text will appear after the number of visitors', 'visitorcounter'); ?>"
><?php _e('Text after the count (with HTML markup):', 'visitorcounter'); ?></label><br />
<input
style="width:100%"
type="text"
id="visitorcounter_after"
name="visitorcounter_after"
value="<?php echo htmlspecialchars (stripslashes ($opt['after'])); ?>"
title="<?php _e('This text will appear after the number of visitors', 'visitorcounter'); ?>"
/>
</p>
<p style="text-align:left">
<label
for="visitorcounter_keepfor"
title="<?php _e('For this number of seconds a visitor\'s IP address will be blocked for counting again', 'visitorcounter'); ?>"
><?php _e('Seconds to block counting the IP again:', 'visitorcounter'); ?></label><br />
<input
style="width:100%"
type="text"
id="visitorcounter_keepfor"
name="visitorcounter_keepfor"
value="<?php echo $kf; ?>"
title="<?php _e('For this number of seconds a visitor\'s IP address will be blocked for counting again', 'visitorcounter'); ?>"
/>
</p>
<p style="text-align:left">
<label
for="visitorcounter_count"
title="<?php _e('This is the actual number of visitors, you can edit it to let your site look more popular than it is', 'visitorcounter'); ?>"
><?php _e('Edit counter value:', 'visitorcounter'); ?></label><br />
<input
style="width:100%"
type="text"
id="visitorcounter_count"
name="visitorcounter_count"
value="<?php echo $cnt; ?>"
title="<?php _e('This is the actual number of visitors, you can edit it to let your site look more popular than it is', 'visitorcounter'); ?>"
/>
</p>
<p style="text-align:left">
<input
type="checkbox"
id="visitorcounter_showtitle"
name="visitorcounter_showtitle"
<?php if($opt['showtitle']) { ?>checked="checked"<?php } ?>
title="<?php _e('If you check this box, the title of the widget will be displayed in the sidebar', 'visitorcounter'); ?>"
/>
<label
for="visitorcounter_showtitle"
title="<?php _e('If you check this box, the title of the widget will be displayed in the sidebar', 'visitorcounter'); ?>"
><?php _e('Show the widget\'s title', 'visitorcounter'); ?></label>
</p>
<p style="text-align:left">
<input
type="checkbox"
id="visitorcounter_listitem"
name="visitorcounter_listitem"
<?php if($opt['listitem']) { ?>checked="checked"<?php } ?>
title="<?php _e('If you check this box, the display will be shown in a HTML list, which is the standard in many themes. Checking this can make the widget\'s appearence more consistent in your theme.', 'visitorcounter'); ?>"
/>
<label
for="visitorcounter_listitem"
title="<?php _e('If you check this box, the display will be shown in a HTML list, which is the standard in many themes. Checking this can make the widget\'s appearence more consistent in your theme.', 'visitorcounter'); ?>"
><?php _e('Display as a list item', 'visitorcounter'); ?></label>
</p>
<p style="text-align:left; font-size:85%;">
<?php _e("This <b>visitor counter</b> widget was developed for you by <a href=\"http://www.tamagothi.de\">Elias Schwerdtfeger</a>. If you like it, please make a little donation in my blog.", 'visitorcounter'); ?>
</p>
<input type="hidden" id="visitorcounter_submit" name="visitorcounter_submit" value="1" />
<input type="hidden" id="visitorcounter_oldcount" name="visitorcounter_oldcount" value="<?php echo $cnt; ?>" />
<?php
}


function wpvc_add_widget ()
{
if (function_exists ('register_sidebar_widget'))
{
register_sidebar_widget (__('Visitor Counter', 'visitorcounter'), 'wpvc_sidebar_widget');
register_widget_control (__('Visitor Counter', 'visitorcounter'), 'wpvc_widget_options', 300, 440);
}
}


add_action ('init', 'wpvc_add_widget');


/*
** It must be a starving man
** Who likes to hear
** These crippled minds talk...
** Greetings from me
** Following the wind.
**
** Wolfsheim, Elias
*/

?>
__________________
http://www.piball.ch
allucinox ist offline   Mit Zitat antworten
Alt 15.05.2008, 01:09   #8 (permalink)
WPD-Team
 
Benutzerbild von codestyling
 
Registriert seit: 30.03.2008
Ort: Leipzig
Beiträge: 999
Also der Link zum Autor reicht völlig, bitte keine kilometerlangen Scripts einkleben. Ich seh mir mal das Original vom Autor an.

Also ab Zeile 92 im Counter, den ich runtergeladen hab, findest du:
PHP-Code:
function wpvc_sidebar_count ($title FALSE$before FALSE$after FALSE$showtitle FALSE$listitem FALSE$keepfor 600)
{
    
$count wpvc_count ($keepfor);
    if (!
$title)
    {
        
$title __('Counter''visitorcounter');
    }
    if (!
$after)
    {
        
$after __('Visitors''visitorcounter');
    }
    echo 
'<li>';
    if (
$showtitle)
    {
        echo 
'<h2>' stripslashes($title) . "</h2>\n";
    }
    echo 
$listitem '<ul><li>' '<p>';
    if (
$before)
    {
        echo 
stripslashes($before) . ' ';
    }        
    echo 
"<span class=\"visitorcount\">$count</span>";
    if (
$after)
    {
        echo 
' ' stripslashes($after);
    }
    echo 
$listitem '</li></ul>' '</p>';
    echo 
"</li>\n";

Das ersetzt du wie folgt:
PHP-Code:
function wpvc_sidebar_count ($title FALSE$before FALSE$after FALSE$showtitle FALSE$listitem FALSE$keepfor 600)
{
    
$count wpvc_count ($keepfor);
    if (!
$title)
    {
        
$title __('Counter''visitorcounter');
    }
    if (!
$after)
    {
        
$after __('Visitors''visitorcounter');
    }
    echo 
'<div class="dbx-box dbx-box-open">';
    if (
$showtitle)
    {
        echo 
'<h3 class="dbx-handle dbx-handle-cursor">' stripslashes($title) . "</h3>\n";
    }
    echo 
'<div class="dbx-content">';
    if (
$before)
    {
        echo 
stripslashes($before) . ' ';
    }        
    echo 
"<span class=\"visitorcount\">$count</span>";
    if (
$after)
    {
        echo 
' ' stripslashes($after);
    }
    echo 
'</div>';
    echo 
"</div>\n";

Sei dir aber im Klaren darüber, dass dies eine spezielle Anpassung und dein aktuelles Theme ist. Falls dir das mal zum Hals raushängt, solltest du es erst mal wieder mit dem Original versuchen.

Geändert von codestyling (15.05.2008 um 01:34 Uhr). Grund: ... Problem gelöst.
codestyling ist offline   Mit Zitat antworten
Alt 15.05.2008, 10:21   #9 (permalink)
PostRank: 9
 
Benutzerbild von Ammaletu
 
Registriert seit: 14.07.2007
Beiträge: 1.429
Wie schon gesagt, das Plugin nutzt nicht die für Widgets vorgesehenen Mechanismen. Ich habe dem Autor mal einen Kommentar hinterlassen. Widgets sollen sich nämlich eigentlich nahtlos in alle Themes einfügen, egal wie deren spezielles HTML nun gerade aussieht. Obiger Fix tut es aber auch, solange keine neue Plugin-Version erschienen ist.
__________________
"Life brings hope and pain, but revenge never brings redemption." || Mein Blog
Ammaletu ist offline   Mit Zitat antworten
Alt 15.05.2008, 11:04   #10 (permalink)
PostRank: 1
 
Benutzerbild von allucinox
 
Registriert seit: 28.12.2007
Ort: Zürich, Schweiz
Beiträge: 43
Hey besten dank. Hat funktioniert....yuhuiiiiiiiiiiiii
hab dich auf meinen Blog verewigt
__________________
http://www.piball.ch
allucinox ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist aus.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:06 Uhr.


Powered by vBulletin® Version 3.7.4 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 | Impressum | Ein Inpsyde.com Projekt