Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [rgbworld] Dereferencing a column name to it's value

Quote Reply
Re: [rgbworld] Dereferencing a column name to it's value In reply to
I think I understand. The user puts in the name of a column from their Links table. You want to get the value for that column loaded into your plugin configuration.

How about something like:

Code:
sub plugin_config {
my $id = shift;
my $rec = $DB->table("Links")->get($id);
my $cfg = Links::Plugins::get_plugin_user_cfg("MyPlugin");
$cfg->{col_name} = $rec->{$cfg->{col_name}};

return { PLG_CFG => $cfg };
}

Then in your template, instead of:

Code:
<%Links::Plugins::get_plugin_user_cfg('MyPlugin')%>

do:

Code:
<%Plugins::MyPlugin::plugin_config($ID)%>

then to access the value, use:

Code:
<%PLG_CFG.col_name%>

Philip
------------------
Limecat is not pleased.
Subject Author Views Date
Thread Dereferencing a column name to it's value rgbworld 3859 Jul 30, 2006, 4:03 AM
Thread Re: [rgbworld] Dereferencing a column name to it's value
fuzzy logic 3776 Jul 30, 2006, 9:37 AM
Thread Re: [fuzzy logic] Dereferencing a column name to it's value
rgbworld 3771 Jul 30, 2006, 5:11 PM
Thread Re: [rgbworld] Dereferencing a column name to it's value
fuzzy logic 3766 Jul 30, 2006, 8:50 PM
Thread Re: [fuzzy logic] Dereferencing a column name to it's value
rgbworld 3746 Jul 31, 2006, 12:36 PM
Thread Re: [rgbworld] Dereferencing a column name to it's value
fuzzy logic 3758 Jul 31, 2006, 8:38 PM
Post Re: [fuzzy logic] Dereferencing a column name to it's value
rgbworld 3733 Jul 31, 2006, 11:40 PM