Gossamer Forum
Home : Products : DBMan : Customization :

Showing text on first page of results only

Quote Reply
Showing text on first page of results only
How do you just show html text on the first page only?

I tried something like :

if ($nh eq "1") {
print qq|
Insert text here on first page only.
|;
};

where $nh is from db.cgi.

but this isn't working.
Quote Reply
Re: [joshuagill] Showing text on first page of results only In reply to
I'm not sure where you're putting this code. The $nh variable is local to sub query in db.cgi. It's in the "my" list at the beginning of the subroutine.

If you want to use a global variable, it would be better to use $in{'nh'}. The %in hash holds all of the information that is sent to the script via a form or URL.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Showing text on first page of results only In reply to
Thanks JPDeni!!

Okay, I got it to work using:

if ($in{'nh'} < 2) {
print qq|
Text|;
};

......but, how can I add a second condition? Such as:

if (($in{'nh'} < 2) and ($rec{'Sold'} eq "No")) {
print qq|
Text|;
};

where $rec{'Sold'} is a field in the record.
Quote Reply
Re: [joshuagill] Showing text on first page of results only In reply to
Where is the code? That makes all the difference.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Showing text on first page of results only In reply to
It is in the sub html_view_success in html.pl
Quote Reply
Re: [joshuagill] Showing text on first page of results only In reply to
It should work if you use

Code:

if (($in{'nh'} < 2) && ($rec{'Sold'} eq "No")) {
print qq|
whatever
|;
}


If this doesn't work, I'll need to know a little more, like why you're doing it, in order to be able to help more.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Showing text on first page of results only In reply to
I got it, but I had to use:

if (($in{'nh'} < 2) && ($in{'Sold'} eq "yes")) {
print qq|
Text|;
}

I guess this pulled the 'Sold' field from the url db.cgi?db=gold&uid=default&view_records=1&Sold=yes&sb=1&so=ascend instead of what was entered in the record.
Quote Reply
Re: [joshuagill] Showing text on first page of results only In reply to
Depends on where it is in the subroutine and lots of other stuff. Position matters. :)

Anyway, you got it to work, which is what matters.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.