Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 04:36 am EST

Geeklog Forums

how to new php_block


pikipokl

Anonymous
hi i am realy new to php.
i wrote

Text Formatted Code
function phpblock_hits() {
<?php
include ("./config.inc.php");
if ($COUNT_CFG['use_db']) {
    include ("./mysql.class.php");
}
include ("./counter.class.php");      
$counter = new dcounter();
$visits = $counter->show_counter();  /* Returns an associative array */
?>

Vsi obiski: <?php echo $visits['total']; ?>
<br/>
<a href="javascript:void(window.open('visitors.php','Visitors','scrollbars=yes,width=420,height=210'))" class="links">Obiski</a> danes: <?php echo $visits['visits_today']; ?>
}
 

in lib-custum.php but it isn't working.
what is wrong??
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
start by getting rid of the php open and close tags within your function. and get rid of the echo as well. try this:
Text Formatted Code

function phpblock_hits() {

include ("./config.inc.php");
if ($COUNT_CFG['use_db']) {
    include ("./mysql.class.php");
}
include ("./counter.class.php");      
$counter = new dcounter();
$visits = $counter->show_counter();  /* Returns an associative array */

$retval = 'Vsi obiski: ' . $visits['total'];
$retval .= '<br/>';
$retval .= '<a href="javascript:void(window.open('visitors.php','Visitors','scrollbars=yes,width=420,height=210'))" class="links">Obiski</a> danes: ' . $visits['visits_today'];

return $retval;
}
 
 Quote

pikipokl

Anonymous
tenks

new problem:

Text Formatted Code
 Fatal error: Cannot instantiate non-existent class: dcounter in /home/mbrega19/public_html/geeklog/system/lib-custom.php on line 152 ( $counter = new dcounter(); )

 
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
you'll have to take a look at your counter.class.php to see how to properly format your corresponding code.
 Quote

pikipokl

Anonymous
Text Formatted Code
    function dcounter() {
        global $COUNT_TBL,$COUNT_CFG;
        if ($COUNT_CFG["use_db"]) {
            $this->db = new dcounter_sql();
            $this->db->connect();
            $this->table = $COUNT_TBL;
        }
        $this->ip = getenv("REMOTE_ADDR");
        $this->host = gethostbyaddr($this->ip);
        $this->config = $COUNT_CFG;
        $this->use_db = ($COUNT_CFG['use_db']) ? true : false;
    }
 


this is in counter.class.php about dcounter
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
perhaps it is just your include path that is wrong...

a php help forum would be more suited to solve your issue, or whoever wrote that class.
 Quote

All times are EST. The time is now 04:36 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content