Gossamer Forum
Home : Products : Links 2.0 : Customization :

Building Errors

Quote Reply
Building Errors
Hi,
I have to insert this sub into my site_html.pl but then i can't build anymore.

sub insert_advert {
my $ad = `/full/path/to/ad.cgi`;
$ad =~ s,Content-type:\stext/html//;
return $ad;
}
I get this error when i build:
Content-type: text/plain Error including libraries: Substitution pattern not terminated.

If i change:
$ad =~ s,Content-type:\stext/html//;
to
$ad =~ s,Content-type:\stext/html/,;
then i get this error:
Content-type: text/plain Error including libraries: Substitution replacement not terminated.

Your help would be really appreciated!
Thank you
Quote Reply
Re: Building Errors In reply to
Thank you!!!
It works, i can build!

But now how can i call the ad?
This is how i have it on the search results page in site_html.pl:
<div align="center"><center>
<table border="0" cellspacing="0" width="600">
<tr>
<td width="100"></td>
<td width="500">&insert_advert
</td>
</tr>
</table>
</center></div>

But in the browser, it comes up as is: &insert_advert in the page (as text) It should be a banner...
I changed the values of the sub to reflect my server path. ( The full path: /home/htdocs/my_domain/cgi-bin/ads/ad.cgi)

Thank you for your help.
Quote Reply
Re: Building Errors In reply to
it's coming up as text in the page because you are outputting it that way. You have to tell perl to stop printing the extact text, and call the routine...

<div align="center"><center>
<table border="0" cellspacing="0" width="600">
<tr>
<td width="100"></td>
<td width="500">

~;
&insert_advert
print qq~ (or "$output . qq~" depending on what you are doing)

</td>
</tr>
</table>
</center></div>

Keep in mind, you can ONLY use the &insertadvert routine with the cgi-generated pages (add, modify, search), and NOT with static pages (category, home, new, cool). For those, you will need to include an SSI call.

--Mark

------------------
You can reach me by ICQ at UIN #8602162


Quote Reply
Re: Building Errors In reply to
try

$ad =~ s,Content-type:\stext/html,,;

and see if that helps

--mark

------------------
You can reach me by ICQ at UIN #8602162


Quote Reply
Re: Building Errors In reply to
Hi,
Thank you for the reply.
But now when i build, i get a syntax error if i use "print qq~" or "$output . qq~" (i tryed them both)
Unfortunatly, i don't know what i'm doing (don't know the difference between "print qq~" or "$output . qq~".
For all i want is to have my banner rotating script work on cgi generated pages.

Thank you for your time, i really appreciate it!
Quote Reply
Re: Building Errors In reply to
which subroutine are you attempting to use? Post your whole subroutine here (not your whole site_html file, just the subroutine).

--Mark

------------------
You can reach me by ICQ at UIN #8602162


Quote Reply
Re: Building Errors In reply to
Hi,
This is the sub:

sub insert_advert {
my $ad = `/full/path/to/ad.cgi`;
$ad =~ s,Content-type:\stext/html,,;
return $ad;
}

Thank you for your time.
Quote Reply
Re: Building Errors In reply to
no, the subroutine that you are adding the &insertadvert call in.

--mark


------------------
You can reach me by ICQ at UIN #8602162


Quote Reply
Re: Building Errors In reply to
Hi Johnny,

I think your syntax error is because there is no ; terminating the line. It should read

&insert_advert;

Hi Mark,

I made it like this and it produces no errors. Unfortunately it produces no advert either. Any idea why?

Best wishes

Michael
Quote Reply
Re: Building Errors In reply to
Hi Zoul,

Not without being able to see anything. It could be your code, it could be your path, it could be your webadverts setup... =)

--mark

------------------
You can reach me by ICQ at UIN #8602162


Quote Reply
Re: Building Errors In reply to
Hi,
Sorry Mark, i'm not sure what exactly you want to see so i'll post all the relevant lines. (Relevant in my opinion...)

First, i'm not getting syntax errors no more, thank you Zoul, i added a ";" at the end of &insert_advert;

But as Zoul pointed out, the banner is not showing up.
So here are the codes:

1. In a normal page (*.htm) this is what i use to rotate my advertisement banners:
<!--#exec cgi="/cgi-bin/banners/all/pub.cgi" --> (it works fine)

On cgi generated pages this method is not working.

2. So this is how i try to call my banners on cgi generated pages:

In site_html.pl, in search results (sub site_html_search_results) this is the code i insert:
<div align="center"><center>

<table border="0" cellspacing="0" width="600">
<tr>
<td width="100"></td>
<td width="500">
~;
&insert_advert;
print qq~
</td>
</tr>
</table>
</center></div>
(no syntax error here)

At the bottom of site_html.pl i insert as last sub this:
sub insert_advert {
my $ad = `/home/htdocs/my_domain/cgi-bin/banners/all/pub.cgi`;
$ad =~ s,Content-type:\stext/html,,;
return $ad;
}

Also, after building pages when i make a search, the banner still won't show up and if i view page source of the search results page this is what i see:
<div align="center"><center>

<table border="0" cellspacing="0" width="600">
<tr>
<td width="100"></td>
<td width="500">

</td>
</tr>
</table>
</center></div>

Notice that this:
~;
&insert_advert;
print qq~

is not there either.

This is all i know...
Thank you all for your help!
Quote Reply
Re: Building Errors In reply to
Hi Mark,

well, it's just this:

sub insert_advert {
my $ad = `/mypath/cgi-bin/ad.cgi`;
$ad =~ s,Content-type:\stext/html,,;
return $ad;
}

And to call that stuff on my search-result page:

print qq~blaba
~;
&insert_advert;
print qq~the rest output
~;

But, as stated before, &insert_advert; produces no output and no errors. Any idea why?

Best wishes


Michael
Quote Reply
Re: Building Errors In reply to
I Got It, i got it, i got it!!!
I'm too happy!!!
Hi Zoul & Mark,
I just figured out the error...
So, this is exactly how i have my code (and it works like a charm)

To call the script:
~;
&advert;
print qq~

The sub:
sub advert {
my $ad = `/full/path/cgi-bin/ads.cgi`;
$ad =~ s,Content-type:\stext/html\n\n,,;
return $ad;
}

Hope that helps Zoul, please post if it works...
Thank you Mark for your help, i remain appreciative!