Quoting music@labyrinth.net.au (music@labyrinth.net.au): > Quoting mike: > > By default, the link type is "simple", which is a simple search. > > You can put "prod_group=X, category=Y" in the "selector" field of > > the cat table and get that to happen. > > > > In fact, I think the 4.9 devel CVS has a pages/admin/layout_auto.html > > file which does that for you automatically. That may even work > > in 4.8. > > Thanks! It certainly does work as far as creating the different search > queries for each link. > > Unfortunately, as is also the case with the 4.8.2 version, it does not auto > generate a complete category list if the products.txt file has a duplicate > category name within a prod_group: > > prod_group category > Dog food > Dog collar > Cat food > Cat flea powder > Thanks for pointing that out. I was not updating the %cat_done differently based on the "narrow" cat_type. I have attached an (untested) version of that page that might do it automatically. -- Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013 phone +1.513.523.7621 <mheins@redhat.com> Fast, reliable, cheap. Pick two and we'll talk. -- unknown[set page_title]Layout auto-populate[/set] [set ui_class]Design[/set] [set page_banner]Layout Editor: Organize your site into categories[/set] [set page_perm]layout=e[/set] [set help_name]layout.edit[/set] [set icon_name]icon_pages.gif[/set] [tmp meta_header] [include include/table_populator] [/tmp] [seti ui_body_extra][/seti] @_UI_STD_HEAD_@
1. Choose a table as the source: | [if !value area_table] [value name=area_table set=products hide=1] [value name=area_column set=prod_group hide=1] [value name=cat_column set=category hide=1] [/if] [loop list="[list-databases]" option=area_table] [loop-code] [/loop] |
2. Choose a column to populate areas: | -- none -- [loop list="[db-columns table='[value area_table]']" option=area_column] [loop-code] [/loop] |
3. Choose a column to populate categories: | -- none -- [loop list="[db-columns table='[value area_table]']" option=cat_column] [loop-code] [/loop] |
4. Choose a search type: | Narrow search (area and category match) Simple search (only category matches) Complex search (template substitution on below) |
5. Complex search code: |
NOTE: Not active unless complex search selected above. fi=products st=db co=yes sf=prod_group se=~PROD_GROUP~ op=eq sf=category se=~CATEGORY~ op=eq sf=inactive se=1 op=ne rf=sku va=banner_text=~BANNER_TEXT~ |
6. Select the page class: | |
7. Select the page area: | |
8. Decide whether to remove previous settings: | No Yes |
9. Click this button to populate: |
[button text="Populate"]
[flag type=write table="area"]
[flag type=write table="cat"]
[seti ui_failure]
[perl tables="area cat [cgi area_table]"]
my $go_page = $CGI->{mv_nextpage};
$CGI->{mv_nextpage} = '@@MV_PAGE@@';
my $ptab = $CGI->{area_table}
or return "no area source table";
my $pdb = $Db{$ptab}
or return "area source table bad";
my $adb = $Db{area}
or return "no area table";
my $cdb = $Db{cat}
or return "no cat table";
my $acol = $CGI->{area_column};
my $ccol = $CGI->{cat_column};
if(! $acol and ! $ccol ) {
return "no column to populate either";
}
my $selector = '';
my $selcode = '';
my %area_defaults = (
name => undef,
which_page => $CGI->{which_page} || 'all',
sort => '05',
sel => $CGI->{sel} || 'left',
display_type => 'name',
);
my %catmap;
my $narrow;
my $lt;
my $search_code;
if($CGI->{cat_type} eq 'simple') {
$lt = 'simple';
$selector = 'category=~CATEGORY~';
$search_code = '';
}
elsif($CGI->{cat_type} eq 'narrow') {
$narrow = 1;
$lt = 'simple';
$selector = < |