Gossamer Forum
Quote Reply
Build_Detail once
I love the idea to build the detailed pages just in the directory where they belong.
So i have changed the dir to %Path% / %ID% (Path is a new field for Category);
this would be perfect as long i would have all links only in one cat.

But i have some more dimensions to save my links.
Now i have added another field "detail" to Category with {0|1}

New York
Paris
London

are the main cats with detail = 1

each link is also in cats:

dogs or cats (detail = 0)

but my pets are never in more than one city!

I want to have the detailed pages beneath the cities.

Now i need a change in

nph-build.cgi

print "Building Detailed pages...\n";

# Only build validated links
$cond ||= GT::SQL::Condition->new;
$cond->add(VIEWABLE);

# Loop through, building 1000 at a time
my ($limit, $offset, $count, $second_pass) = (1000, 0, 0);
my $rel = $DB->table(qw/Links CatLinks Category/);
print "\t";

my $Links = $DB->table('Links');
while () {

Is this query only from Links or also from CatLinks, Category, because of $rel?
Then i just add another $cond?
Quote Reply
Re: [Robert] Build_Detail once In reply to
Not 100% sure what you want to do, but as far as I see you have to look a couple of lines further.
CatLinks and Category is included as you said but as well:
Code:

$rel->select_options("GROUP BY LinkID") if $CFG->{build_detail_format} eq '%ID%';
$rel->select_options("ORDER BY LinkID");

The loop you are looking at is not the loop doing the queries:

Code:
my $sth = $rel->select('Links.*', @cat_cols, 'CategoryID' => $cond);

Is probably your problem. I work with dynamic pages, but at first sight I would say detailed pages are built for every Category which means you can not influence their location as easy as you might wish.

Regards

n||i||k||o
Quote Reply
Re: [el noe] Build_Detail once In reply to
It is just another $cond like

# Only build validated links
$cond ||= GT::SQL::Condition->new;
$cond->add(VIEWABLE);

## Take only that cats with field detail = 1;
$cond->add('detail','=','1');


# Loop through, building 1000 at a time
my ($limit, $offset, $count, $second_pass) = (1000, 0, 0);
my $rel = $DB->table(qw/Links CatLinks Category/);
print "\t";

my $Links = $DB->table('Links');
while () {
# Links can be in multiple categories, make sure their detailed pages are only built once
# $rel->select_options("GROUP BY LinkID") if $CFG->{build_detail_format} eq '%ID%';
# build detailed in %Path%/%ID%
$rel->select_options("GROUP BY LinkID");
$rel->select_options("ORDER BY LinkID");

Last edited by:

Robert: Oct 12, 2017, 10:00 AM
Quote Reply
Re: [Robert] Build_Detail once In reply to
Looks interesting, how do handle the link from the category pages to the detailed pages?
Quote Reply
Re: [el noe] Build_Detail once In reply to
el noe wrote:
Looks interesting, how do handle the link from the category pages to the detailed pages?

Because of german Umlauts i solved the path story with:
a new field Path for Category with something like "categoryname/subcategoryname"
and with two globals for rootpath, fatherpath for a breadcrump.

Probably the half of this was not needed, but i like to play with LSQL
Quote Reply
Re: [Robert] Build_Detail once In reply to
Sounds like similar problems I had with Umlauts, I ended up with using the CategoryID Angelic