Parsing vars to an external php script

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
mdgroot
Posts: 155
Joined: Wed 11. Feb 2004, 17:47
Location: Netherlands

Parsing vars to an external php script

Post 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.
phpWCMS v1.27
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

mdgroot
Posts: 155
Joined: Wed 11. Feb 2004, 17:47
Location: Netherlands

Post 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...
phpWCMS v1.27
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

schon mal mit

Code: Select all

[PHP]
$GLOBALS[pageName] = 'Index page';
[/PHP]
probiert
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
mdgroot
Posts: 155
Joined: Wed 11. Feb 2004, 17:47
Location: Netherlands

Post 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 :wink:
phpWCMS v1.27
rushclub
Posts: 915
Joined: Tue 17. Feb 2004, 18:52

Post by rushclub »

if you have any success on this topic please write an tutorial how to implement bbclone :)

rush
3 (!) Jahre warten reichen mir. Ich bin erst mal weg.
mdgroot
Posts: 155
Joined: Wed 11. Feb 2004, 17:47
Location: Netherlands

Post 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 :wink:
phpWCMS v1.27
mdgroot
Posts: 155
Joined: Wed 11. Feb 2004, 17:47
Location: Netherlands

Post by mdgroot »

does somebody knows how to do this ?
phpWCMS v1.27
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post 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? :lol:

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?
mdgroot
Posts: 155
Joined: Wed 11. Feb 2004, 17:47
Location: Netherlands

Post by mdgroot »

That's a nice idea, but the basic problem right now is that I cannot get a variable into an external script..... :cry:
phpWCMS v1.27
kubens
Posts: 168
Joined: Sat 6. Nov 2004, 15:29
Location: Duesseldorf near Cologne ;-)

Post 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
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

whats wrong with VTS (phpOentracker) ?
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
Post Reply