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
<?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??
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??
11
8
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:
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;
}
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;
}
13
14
Quote
pikipokl
Anonymous
tenks
new problem:
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(); )
28
13
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.
14
11
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
13
9
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.
a php help forum would be more suited to solve your issue, or whoever wrote that class.
10
10
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