Hi all,
I want to allow users to tag links by "industry vertical". Because a link can exist in more than one vertical, I've decided to make a new table called verticals that has all the industry ids, and also create a VerticalLink reference table to store cases where one link can have many industries associated with it.
I've made my industry table and can pull it into include_form.html without any problems using a global as follows:
# -------------------------------------------------------------------
# Returns a select box of all industries
#
my $output = "";
my $element_name = \'VertLinks.VerticalID\';
my $db = $DB->table (\'Verticals\');
my $sth = $db->select ( [\'ID\', \'Name\'] );
while (my $cat = $sth->fetchrow_hashref) {
$output .= "<input name=\'$element_name\' type='checkbox\' value=\'$cat->{ID}\'>$cat->{Name}<br>";
}
return $output;
}',
(this global will need some more work, but it does what I need it to for the time being)
Where I'm having problems is getting the verticalID value into the VertLinks table. I'm using CatLinks as a template and basically duplicated it with all the the correct names. I've resynched the databases and when I add a new record, I don't generate any error. But of course I'm not seeing any new data in the VertLinks table.
Here's my VertLinks.def file:
'ai' => '',
'cols' => {
'LinkID' => {
'default' => '0',
'form_size' => '10',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '1',
'type' => 'INT',
'unsigned' => '1',
'zerofill' => '0'
},
'VerticalID' => {
'default' => '0',
'form_size' => '10',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '2',
'type' => 'INT',
'unsigned' => '1',
'zerofill' => '0'
}
},
'fk' => {
'cis_Links' => {
'LinkID' => 'ID'
},
'cis_Verticals' => {
'VerticalID' => 'ID'
}
},
'fk_tables' => [],
'index' => {
'lndx' => [
'LinkID'
],
'vertlnndx' => [
'VerticalID'
]
},
'pk' => [],
'subclass' => {
'html' => {},
'table' => {}
},
'unique' => {}
};
This seems like it should be fairly straight forward, but with out any errors, I'm for the time being stumped. Can someone point me in the right direction?
Thanks,
Mike
I want to allow users to tag links by "industry vertical". Because a link can exist in more than one vertical, I've decided to make a new table called verticals that has all the industry ids, and also create a VerticalLink reference table to store cases where one link can have many industries associated with it.
I've made my industry table and can pull it into include_form.html without any problems using a global as follows:
Code:
'get_verticals' => 'sub { # -------------------------------------------------------------------
# Returns a select box of all industries
#
my $output = "";
my $element_name = \'VertLinks.VerticalID\';
my $db = $DB->table (\'Verticals\');
my $sth = $db->select ( [\'ID\', \'Name\'] );
while (my $cat = $sth->fetchrow_hashref) {
$output .= "<input name=\'$element_name\' type='checkbox\' value=\'$cat->{ID}\'>$cat->{Name}<br>";
}
return $output;
}',
(this global will need some more work, but it does what I need it to for the time being)
Where I'm having problems is getting the verticalID value into the VertLinks table. I'm using CatLinks as a template and basically duplicated it with all the the correct names. I've resynched the databases and when I add a new record, I don't generate any error. But of course I'm not seeing any new data in the VertLinks table.
Here's my VertLinks.def file:
Code:
{ 'ai' => '',
'cols' => {
'LinkID' => {
'default' => '0',
'form_size' => '10',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '1',
'type' => 'INT',
'unsigned' => '1',
'zerofill' => '0'
},
'VerticalID' => {
'default' => '0',
'form_size' => '10',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '2',
'type' => 'INT',
'unsigned' => '1',
'zerofill' => '0'
}
},
'fk' => {
'cis_Links' => {
'LinkID' => 'ID'
},
'cis_Verticals' => {
'VerticalID' => 'ID'
}
},
'fk_tables' => [],
'index' => {
'lndx' => [
'LinkID'
],
'vertlnndx' => [
'VerticalID'
]
},
'pk' => [],
'subclass' => {
'html' => {},
'table' => {}
},
'unique' => {}
};
This seems like it should be fairly straight forward, but with out any errors, I'm for the time being stumped. Can someone point me in the right direction?
Thanks,
Mike