Date: 10/20/00
- Next message: Pankaj Gupta: "[phplib] Extracting links from a HTML File"
- Previous message: Victor M. Varela: "[phplib] Please, include Interbase support in PHPLIB"
- Maybe in reply to: dog: "[phplib] templates limit quick functionality adding?"
- Next in thread: Kristian Koehntopp: "Re: [phplib] templates limit quick functionality adding?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>Hi,
>I'm trying to implement a site using PHPLIB Templates. To speed up
>development, I want to use scripts like phpPolls to just slap on
>functionality on the site. That particular program requires me to only
>include some code and stick in a function to display a nice poll. The
>obvious problem is it's usage of 'echo' and particularly 'printf's that
make
>it impossible to control the location of the output.
>
>Based on what I can see, it seems like the only option is to go through the
>entire code for the addon script and rewrite it so the result of every
>'echo' in fact get's put into a string which gets returned by the function.
>Then all I have to do is something like:
> //as all output from that function is returned in a string
> $pollvar=makepoll(parameters ...)
> $t->parse($pollvar,$template)
>
>Would I be correct in assuming this is my only/best option? The problem
with
>that being that heavily editing prewritten programs could cause
consequences
>that I wouldn't have taken into account - not to mention negating the ease
>of merely putting a reference to a function.
>
>Thanks.
As I see it, you effectively need to replace the echo / printfs functions.
But you don't need to create so much functions :
At the page beginning, create the template object and each time you get to
an echo or a
printfs, you change it to a set_var like $t->set_var("POLL", myvalue);
In case you need to concatenate the value, you make $t->set_var("POLL",
$t->get_var("POLL").myvalue);
In the template you put the {POLL} marker and it works.
In case you don't need the {POLL} marker, you can initialize it at the
beginning of your page and that's it.
I don't know if I'm clear enough, if my english is good enough or if I have
answered your question, but that's the way I would make it work.
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Pankaj Gupta: "[phplib] Extracting links from a HTML File"
- Previous message: Victor M. Varela: "[phplib] Please, include Interbase support in PHPLIB"
- Maybe in reply to: dog: "[phplib] templates limit quick functionality adding?"
- Next in thread: Kristian Koehntopp: "Re: [phplib] templates limit quick functionality adding?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

