PDA

View Full Version : php code in header.... continued


shri
Fri 5th May '00, 1:25am
John,

I'm starting a new thread since I could not find the reply button in the last thread I started.

this is my code....


$header="<center>";
require("/usr/local/apache/sites/gandmasti.net/htdocs/phpads/config.inc.php3");
require("/usr/local/apache/sites/gandmasti.net/htdocs/phpads/view.inc.php3");
require("/usr/local/apache/sites/gandmasti.net/htdocs/phpads/acl.inc.php3");
$header.=view("paid");
$DB_site->query("USE $dbname");
$header.="</center>";


As you can see I do have the $header.=view("paid"); the view function in this case is outputting HTML.

John
Fri 5th May '00, 1:36am
What does this view funtion do though? Does it echo (i.e. print the code) or does it return it in a variable? If it prints the code, you will have to modify it slightly so that it returns it in a variable.

To do this, anywhere in the view function, replace "echo" with "$returnvar .= " (without the quotes), then just before the end of the function, add:


return $returnvar;


John

JonnyQuest
Fri 5th May '00, 6:30am
Shri,
Did you have any success with this?
I too am trying to implement PHPAds, however, when I went to change the script, I noticed there are a lot of echo statements.
I'm likely going to change them all, but I thought I would see if you pulled it off or found another way around it...
Thanks.

JonnyQuest
Fri 5th May '00, 7:03am
I just had another thought...
Am I correct to read that this means I can't include straightforward calls to PHP scripts within my variables?
If so, is there any way for me to do this? I was planning on using vB as a stepping stone to move much of my Perl to PHP. I was going to expand on vB's variable system as a publishing system...
Any thoughts?

Martin
Fri 5th May '00, 7:16am
WebStyles suggested using the "passthru()" call to parse outside program calls in the header. I haven't tried this yet, but it might work.

shri
Fri 5th May '00, 9:00am
Hi John,

Its using an echo to print the HTML and returns a variable. Sorry, forgot to mention that.

Changing the echo to putting it into a variable worked. However, that is only valid when you've used HTML as the banner source, there are occaisions when you store the image as a gif. Will have to see how this would work.

But, I do have the issue fixed well enough to move onto the next one :)

Shri

[Edited by shri on 05-05-2000 at 09:09 PM]

John
Fri 5th May '00, 9:40pm
Images:

The ad system should return some <img> codes in the HTML, calling itself to show the images. You do want to keep the echo statements in the image returning functions.

John

Martin
Fri 12th May '00, 3:17am
Originally posted by shri
Changing the echo to putting it into a variable worked. However, that is only valid when you've used HTML as the banner source, there are occaisions when you store the image as a gif. Will have to see how this would work.


Shri, that's an easy one :) Simply make either an html page with the relvant banner and link and ref it in the ad software or save it as a text file and use it like that.

Now, on to my question. What PHPAds file(s) did you have to change all the "echo" statements in to get it to work? I'm anxious to get this off the ground:)

[Edited by Martin on 05-12-2000 at 02:20 PM]

shri
Fri 12th May '00, 10:01am
Martin,

I think I changed it in view.inc.php3 instead of echo row; I used a return (row).

Right now, I am giving vB a bit of a rest until we get a version which allows all templates to be parsed.

For UBB I had set up .html files to be server parsed and had inserted a fair amount of code here and there to include a bunch of things into the body / headers / footers.

Also, a very weird thing... I have a feeling if you post multiple times to a post and have forgotten to select "email user" it does not e-mail you anymore. Weird, I don't seem to get e-mails of responses anymore.