Gossamer Forum
Home : Products : DBMan : Customization :

Displaying three most recent on static html

Quote Reply
Displaying three most recent on static html
Sorry if this was already mentioned, but i couldn't find any specific one.

How would I place using SSI a number of records sorted by dates.

Lets say I wanted dates greater than 07-Jul-2000 and wanted to display the top 5 on an html page.

I could get one to display (minus any headers or footers) when I created a separate subroutine in db.cgi and html.pl called view_records_ssi and html_view_records_ssi using view_records as a guide.

The problem comes in when I try to display more than one record. I get an error. I'm using the short/long display.

Is there any easier way to do this? If not, what is the fix to solve my problem.

Thanks ahead of time.

Quote Reply
Re: Displaying three most recent on static html In reply to
What code did you use to try to get more than one record?

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Displaying three most recent on static html In reply to
I'm not sure I understand what you mean.

I figured that I would use view_success minus any headers and footers, so that it would output only the records. Then I made the hidden field for mh at 3 so only three would be displayed. Then I did the greater than (or less than, i forgot) today's date to display the most recent ones.

It worked when I tried to display only one record but when multiple results came in, I got errors.

So as I trial run I did a search regularly with all the dates and maximum hit requirements down. Then I changed the "view_records" part of the url to "view_records_ssi" (the name of my subroutines, identical to view_record, minus footer & header). Then that's what I included in my static html.

Should this work? Or is there a better more efficient way?

Thanks ahead of time.



Quote Reply
Re: Displaying three most recent on static html In reply to
i just read the other post to long327 about the date search. Should I utitlize that also? And then what would I do then to handle the multiple results?

Thanks

Quote Reply
Re: Displaying three most recent on static html In reply to
I see now what you mean.

I think I need to see the subroutines you wrote. I don't know diddly about SSI, but I might be able to figure out where your problem is.


JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Displaying three most recent on static html In reply to
Well I'm trying of other ways to get this to work. But anyhow, here are my subroutines (well the ones I think are important)

http://www.getsensored.com/help.txt

Quote Reply
Re: Displaying three most recent on static html In reply to
You didn't include sub html_record_long_ssi.



JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Displaying three most recent on static html In reply to
Why do I need to include a record_long_ssi? Wouldn't I use the same subroutine record_long?

I wanna keep the same look when displaying the records on my static page, using the short display, which link to the long display. So I don't think I need to redo the long one because I'm not using it anywhere in the SSI. When I follow the link to the long display, it would be displayed as it normally would if searching through the database.

Quote Reply
Re: Displaying three most recent on static html In reply to
In Reply To:
Why do I need to include a record_long_ssi?
Because you reference it in your other subroutine.

Code:
if (($db_total_hits == 1) or ($maxhits == 1)) {
&html_record_long_ssi(&array_to_hash(0, @hits));
}
Code:
for (0 .. $numhits - 1) {
print "<tr>";
&html_record_long_ssi(&array_to_hash($_, @hits));
print "</tr>";
++$i;
}

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Displaying three most recent on static html In reply to
oh yeah! oops my bad.

Yeah i did include record_long_ssi, but it was basically the same thing as record_long but with a few modifcations.

Now that i really think about it, I don't think this will work :-(

But if you can help me, I would really appreciate it.


Quote Reply
Re: Displaying three most recent on static html In reply to
Well, I'm not sure about how to make it work, either, since I don't know anything about SSI.

Have you looked through the past forum messages? There's lots of stuff in here and I'm sure it could help you.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Displaying three most recent on static html In reply to
sensored:

You may want to check the FAQ noted below .. I'm sure I have most of the referenced thread regarding SSI.

Please look under "Working with Files & Records" and then under subtitle of "SSI & External Files" perhaps you will find some ideas or solutions there.

Hope this helps


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Displaying three most recent on static html In reply to
Of course! Sorry JP for taking so much of your time!

I totally forgot about the FAQ (actually I didn't even know it had that type of info in there :-) Well anyways thanks alot.

sensored