the beauty of Links SQL is making the database objects allow easy access to do anything with the database..
databases can be created to do anything.. in most of my links sql projects that people have paid me to do I make numerous tables for different levels of data.. searching multiple databases is much easier than modding nph-build.cgi though.. nph-build.cgi is the largest hassle in this.. i went about it this way.. another field in category db.. called it.. 'Database'.. database is either Hardware, Software or Accessories.. there is only one database for categories.. so that doesn't matter.. there are three databases for links.. for building category pages.. i checked which database to use by using the $category_r->{Database} scalar.. then i changed this line..
to..
$get_links = $LINKDB->prepare (" SELECT * FROM $OUT{Database} WHERE CategoryID = ? ORDER BY $LINKS{build_sort_order_category} LIMIT 1000 ");(and i obviously put that into the loop..)
then there are many occurences of these..
so i assigned the object to the correct DB to $DB with ifelse statements..
and with all the hashrefs.. i put.. $tmp->{Database} = $OUT{Database}; so i could check in HTML_Templates.pm which template to use.. (simply by make the template.. "${$tags}{Database}_link.html"
ok.. that is category pages..
umm.. now what... detailed pages??
ok.. well.. i just made a loop.. ie.. foreach (@database) {
}..
so basically it goes through each of them getting each record..
i didn't do anything else.. too complicated..
Jerry Su
databases can be created to do anything.. in most of my links sql projects that people have paid me to do I make numerous tables for different levels of data.. searching multiple databases is much easier than modding nph-build.cgi though.. nph-build.cgi is the largest hassle in this.. i went about it this way.. another field in category db.. called it.. 'Database'.. database is either Hardware, Software or Accessories.. there is only one database for categories.. so that doesn't matter.. there are three databases for links.. for building category pages.. i checked which database to use by using the $category_r->{Database} scalar.. then i changed this line..
Code:
$get_links = $LINKDB->prepare (" SELECT * FROM Links WHERE CategoryID = ? ORDER BY $LINKS{build_sort_order_category} LIMIT 1000 ");Code:
$OUT{Database} = $category_r->{Database}; $get_links = $LINKDB->prepare (" SELECT * FROM $OUT{Database} WHERE CategoryID = ? ORDER BY $LINKS{build_sort_order_category} LIMIT 1000 ");
then there are many occurences of these..
Code:
$tmp = $LINKDB->array_to_hash (${$links_r}[$i]);and with all the hashrefs.. i put.. $tmp->{Database} = $OUT{Database}; so i could check in HTML_Templates.pm which template to use.. (simply by make the template.. "${$tags}{Database}_link.html"
ok.. that is category pages..
umm.. now what... detailed pages??
ok.. well.. i just made a loop.. ie.. foreach (@database) {
}..
so basically it goes through each of them getting each record..
i didn't do anything else.. too complicated..
Jerry Su