Parsing vars to an external php script
Parsing vars to an external php script
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.
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.
phpWCMS v1.27
Hi Pico,
I now have this in my html contentpart;
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
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>
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

phpWCMS v1.27
@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:
then have on every page in phpwcms an extra HTML Contentpart
contents HTML contentpart:
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
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);
?>
contents HTML contentpart:
Code: Select all
<iframe src="counter_mainpage.php" height="1" width="1"></iframe>
- and now I want to have ofcourse phpwcms parse a variable so I can have only 1 external script

phpWCMS v1.27
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?

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?
I am using phpwcms and bbclone on my sites. I did this on the following way:
phpwcms: inside a template
/img/blank.php
/bbclone/lib/marker.php
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
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 -->
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");
?>
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));


Br
Wolfgang