Gossamer Forum
Home : Products : DBMan : Customization :

Re: [smeempress] I can't fine the Random record mod on JPDeni's website

Quote Reply
Re: [smeempress] I can't fine the Random record mod on JPDeni's website In reply to
Quote:
I will create a empty txt file called random.txt in the dbman folder

Right.

Quote:

paste the code above into db.cgi right after "Local(%sortby);" in subquery

Right.

Quote:

I will aslo have to add a number field to my database definition, and match the field number to the number "25" above in the code, is that right?

Right. And you will have to add a place for the field to each record. If you add the field at the end of the list of fields in your .cfg file (which is the best way to do it, you'll just have to add an extra delimiter to the end of each record. For example, if your delimiter is the |, and you have a record like:

23|John|Doe|New York|New York|Godzilla|purple

add an extra delimiter so that it looks like

23|John|Doe|New York|New York|Godzilla|purple|

Quote:

Do I have to do anything else to the html.pl and default.cfg file?

In html.pl, sub search options, you might want to remove

Code:

Sort By:
<SELECT NAME="sb">
<OPTION>---
~; for (my $i =0; $i <= $#db_cols; $i++) { print qq~<OPTION VALUE="$i">$db_cols[$i]</OPTION>\n~ if ($db_form_len{$db_cols[$i]} >= 0); } print qq~
</SELECT>
Sort Order:
<SELECT NAME="so">
<OPTION VALUE="ascend">Ascending
<OPTION VALUE="descend">Descending
</SELECT>


and add

Code:

<input type=hidden name="sb" value="25">


Be sure to change 25 to the actual number of your randomizing field.

This will make every search have the random order display.

Also, change

Code:

print qq!| <A HREF="$db_script_link_url&view_records=1&$db_key=*">List All</A> ! if ($per_view);


to

Code:

print qq!| <A HREF="$db_script_link_url&view_records=1&$db_key=*&sb=25">List All</A> ! if ($per_view);


again, changing the 25 to match your field number.

I think that should do it.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Subject Author Views Date
Thread I can't fine the Random record mod on JPDeni's website smeempress 18373 Jan 23, 2006, 1:27 PM
Thread Re: [smeempress] I can't fine the Random record mod on JPDeni's website
smeempress 18139 Jan 23, 2006, 2:04 PM
Thread Re: [smeempress] I can't fine the Random record mod on JPDeni's website
JPDeni 18187 Jan 23, 2006, 5:34 PM
Thread Re: [JPDeni] I can't fine the Random record mod on JPDeni's website
smeempress 18133 Jan 24, 2006, 7:15 AM
Thread Re: [smeempress] I can't fine the Random record mod on JPDeni's website
JPDeni 18176 Jan 24, 2006, 8:08 AM
Thread Re: [JPDeni] I can't fine the Random record mod on JPDeni's website
smeempress 18195 Jan 24, 2006, 8:35 AM
Thread Re: [smeempress] I can't fine the Random record mod on JPDeni's website
JPDeni 18133 Jan 24, 2006, 11:43 AM
Thread Re: [JPDeni] I can't fine the Random record mod on JPDeni's website
smeempress 18149 Jan 24, 2006, 1:40 PM
Thread Re: [smeempress] I can't fine the Random record mod on JPDeni's website
JPDeni 18149 Jan 24, 2006, 9:05 PM
Thread Re: [JPDeni] I can't fine the Random record mod on JPDeni's website
smeempress 18154 Jan 25, 2006, 7:24 AM
Thread Re: [smeempress] I can't fine the Random record mod on JPDeni's website
JPDeni 18127 Jan 25, 2006, 10:46 AM
Post Re: [JPDeni] I can't fine the Random record mod on JPDeni's website
smeempress 18094 Jan 25, 2006, 12:37 PM
Thread Re: [JPDeni] I can't fine the Random record mod on JPDeni's website
smeempress 18103 Jan 26, 2006, 2:26 PM
Thread Re: [smeempress] I can't fine the Random record mod on JPDeni's website
smeempress 18104 Jan 26, 2006, 2:40 PM
Thread Re: [smeempress] I can't fine the Random record mod on JPDeni's website
JPDeni 18100 Jan 26, 2006, 6:58 PM
Post Re: [JPDeni] I can't fine the Random record mod on JPDeni's website
smeempress 18103 Feb 2, 2006, 7:35 AM