On Mon, Sep 7, 2009 at 12:44 PM, Kevin<[email protected]> wrote:
>
> Going nuts over something I thought would be simple.
Uh oh...
> I wrote a plugin that creates a page counter function. I'm sure that
> this could be done from within Boltwire directly without a plugin, but
> it gave me another shot at trying a plugin to see if I understood how
> they worked better. the shell of it could be used by others to access
> all kinds of data outside of the system. I also wanted to see if I
> could catch php errors and place them into an error variable without
> them being exposed so it uses ob_start, ob_get_contents and
> ob_end_clean which seems to work.
I don't know if using ob_start, etc causes problem, because I don't
fully understand what these functions do, but they are used in
engine.php around line 230. It's possible there is a conflict...
> It places in system vars four values values:
>
> {pgcount} Page Count for that page
> {pgpage} Page that is being counted
> {pgcountfile} Full path of the countfile
> {pgerror} Output of errors (the ob_ related stuff)
>
> So... I wanted to put the call to the function in the top zone so that
> it would set the values, so they could be used anywhere (main/side/
> bottom) etc...
I think this would work.
> So I put
>
> [(pagecount)]
>
> in the top. Believing that that on its own would not display
> anything.
It should not display anything except what the function returns. You
can try turning it off by doing
[(pagecount output=false)]
There are several output options available to virtually all functions,
including false, source, nolines, csv, and escape just to keep things
interesting. But that doesn't explain why you are getting output.
There must be something in your script that is returning a value.
Could you share your function BOLTpagecount?
> And added
>
> Access # {pgcount}
>
> To the bottom section.
>
> Works great, except that in the top it outputs the title of the page
> even though I would not expect it to output anything.
>
> So... I tried using it as a template like
>
> [(pagecount template=pgp)]
> /*[#pgp][#pgp]*/
Normally the template parameter won't do anything unless you are
calling the display engine somewhere in your script. So this is very
curious indeed. I have no clue why it is doing this. I just checked it
on my system to make sure it wasn't some bug, and its working
perfectly. I'm almost sure it is in your script.
> Which I thought would output nothing as well... but when I do that it
> outputs pgp
>
> So how do I get the plugin to not output any data but still load its
> stuff?
>
> What it does...
>
> Basically the plugin creates in a counter directory a file named after
> the page that is being viewed and uses that file to keep a count of
> how often it has been loaded. Each time that page is loaded, the
> counter increments the number and sets the variables as mentioned
> above so they could be used.
Here's how to do that in BoltWire. Put in footer or somewhere:
Page viewed [(info counter field={p} target=info.pagecount)] times...
It stores all your data in one page: info.pagecount, using the page
name as a key, and the "counter" info command simply increments that
info value by one. (BTW info commands are extensibel as well...). This
gives you a lot of real nice capabilities. For example:
{info.pagecount::{p}} Gives current page count. Change {p} to other page...
[(info count group=forum* target=info.pagecount)] Give total number
of pages viewed in forum group
[(info sum target=info.pagecount sort={+value} count=20)] Combined
page views of 20 most popular pages.
[(info report target=info.pagecount sort={+value} count=20
template="[[{+field}]]: {+value}")] A report of 20 most popular pages
& count
etc. There are many possibilities built in. If you have noticed from
the last few changes, BoltWire evolved by not some much hacking
patches, but where possible by moving capabilities farther up the
chain and interconnecting systems. It gives a lot of flexibility.
If you need this info outside of BoltWire, it should be easy to hack a
little code to extract the info from the info.pagecount page.
Cheers,
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---