Page 1 of 1
Parsing vars to an external php script
Posted: Fri 30. Jun 2006, 02:35
by mdgroot
Is there a way to do this ?
I have an external script which needs a var from phpwcms.
I have e.g.:
$pageName = "Index";
in my article and I want to use that var in my external script.
Posted: Fri 30. Jun 2006, 05:04
by DeXXus
Posted: Fri 30. Jun 2006, 10:51
by mdgroot
Thanks, but I cannot get it to work.
I have URL rewriting on.
I have in every article (html content) :
[PHP]
$pageName = "index page";
[/PHP]
and then I call an external script which must now the variable $pageName.
But whatever I try, the var stays empty...
Posted: Fri 30. Jun 2006, 10:57
by pico
Hi
schon mal mit
Code: Select all
[PHP]
$GLOBALS[pageName] = 'Index page';
[/PHP]
probiert
Posted: Fri 30. Jun 2006, 11:08
by mdgroot
Hi Pico,
I now have this in my html contentpart;
Code: Select all
[PHP]
$GLOBALS[pageName] = 'Index page';
[/PHP]
<iframe src="counter.php" height="1" width="1"></iframe>
so, now I call counter.php and that script has to know the variable pageName so I can do a check on which page the var came from.
The whole idea behind it is that I'm trying to get BBCLONE statistics working to log the pagevisits.
If I can export the pagename variable I can use a switch function to determine what pagename to write to the statistics.
I have it working with calling a counter_xx.php within an Iframe for every page, but I want it in 1 file.
Hope I'm clear

Posted: Fri 30. Jun 2006, 11:30
by rushclub
if you have any success on this topic please write an tutorial how to implement bbclone
rush
Posted: Fri 30. Jun 2006, 11:51
by mdgroot
@rushclub
For a temp solution this is what I use now;
Have a external php file for every page in your phpwcms site which you want to have logged in the stats of bbclone:
contents counter_mainpage.php:
Code: Select all
<?
define("_BBC_PAGE_NAME", "Mainpage");
define("_BBCLONE_DIR", "bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);
?>
then have on every page in phpwcms an extra HTML Contentpart
contents HTML contentpart:
Code: Select all
<iframe src="counter_mainpage.php" height="1" width="1"></iframe>
and now bbclone is also logging the pages. (I tried everything, but the only way it is working, as far as I know, is with an IFRAME.
- and now I want to have ofcourse phpwcms parse a variable so I can have only 1 external script

Posted: Sat 1. Jul 2006, 22:27
by mdgroot
does somebody knows how to do this ?
Posted: Sat 1. Jul 2006, 23:10
by DeXXus
I do not know the program BBCLONE statistics, and what you are trying to feed it. Are you after the bare script name (like via Server environment variables) or more? You could examine the phpinfo() for server Environment variable block to see which... results in the portion you are try to extract. Something like $_SCRIPT_FILENAME -or- ($_REQUEST_URI / $_SCRIPT_NAME / $_PATH_INFO)? Or what?
I would think that using the Page Title would be -another- way to count accesses... each time the page is visited the Page Title could be derived and fed back to the counting script. That would use {PHPVAR:$GLOBALS['content']['struct'][$GLOBALS['content']['cat_id']]['acat_name']} -or- {PAGETITLE} and a table of article titles w/ counts could be compiled.
What do think you would like to extract and feed to this script?
Posted: Sun 2. Jul 2006, 20:35
by mdgroot
That's a nice idea, but the basic problem right now is that I cannot get a variable into an external script.....

Posted: Sat 8. Jul 2006, 10:04
by kubens
I am using phpwcms and bbclone on my sites. I did this on the following way:
phpwcms: inside a template
Code: Select all
<!-- tracker: begin -->
<script type="text/javascript" language="JavaScript">
<!--
var ref=escape(document.referrer);
if (document.images) { var img = new Image(); img.src = "/img/blank.php?page=$url&ref="+ref; } else { document.write ('<img src="/img/blank.php?page=$url&ref='+ref+'" height="0" width="0" alt="">'); }
//-->
</script>
<noscript>
<img src="/img/blank.php?page=$url&ref=nojavascript" height="0" width="0" alt="">
</noscript>
<!-- tracker: end -->
/img/blank.php
Code: Select all
<?php
define("_BBC_PAGE_NAME", rawurldecode(urlencode($page)));
define("_BBC_REF", str_replace("\"", "", rawurldecode(urlencode($ref))));
define("_BBCLONE_DIR", "../bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);
header("Content-Type: image/gif;");
header("Location: /img/spacer.gif");
?>
/bbclone/lib/marker.php
Code: Select all
# go to line number 301
# and replace the original code
$HTTP_REFERER = !$HTTP_REFERER ? "unknown" : $this->filter_ref($HTTP_HOST, $HTTP_REFERER, $SERVER_ADDR);
# by this enhanced code
$HTTP_REFERER = defined("_BBC_REF") ? $this->filter_ref($HTTP_HOST, _BBC_REF, $SERVER_NAME, $SERVER_ADDR) :
(empty($HTTP_REFERER) ? "unknown" : $this->filter_ref($HTTP_HOST, $HTTP_REFERER, $SERVER_NAME, $SERVER_ADDR));
By the way I am sill looking forward to finding a database based solution. I played a little bit with
php-stats in the past, but in the meantime the site is switched off

Now I am playing with
phpmv2. However I am interested in a good tracking tool, so if anybody has some good experiences and will share those with me, this would be great
Br
Wolfgang
Posted: Sat 8. Jul 2006, 10:33
by pico
Hi
whats wrong with VTS (phpOentracker) ?