Gossamer Forum
Quote Reply
Looking for the CatID
Hello,
Im trying to get the CatID number to be placed in a column field in our database and am using the following:
Code:
<input type="hidden" id="templateID" name="templateID" value="<%CatID%>" class="text">

But apparently it's not working. I also tried:
Code:
<input type="hidden" id="templateID" name="templateID" value="CatID" class="text">

Which also didn't work.

Any clues how to get the CatID number to write itself from the include_form.html template into the templateID field in the database record?

Thanks,
Quote Reply
Re: [Westin] Looking for the CatID In reply to
Mmm, any particular reason you are trying to do this? Its easier to just get it out when using it (in case you change the category something is in)

Simple as:

get_cat_id
Code:
sub {
return $DB->table('CatLinks')->select ( ['CategoryID'], { LinkID => $_[0] } )->fetchrow;
}

..then call with (in link.html, detailed.html etc)

Code:
<%get_cat_id($ID)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for the CatID In reply to
Thanks I'll try that.

The reason that Im doing this is to try to make my life easier on setting up multiple templates inside of the luna templates. Based on what templateID a record has will determine what is shown to the user and what isn't.

I know we discussed the other way of doing it, but for some reason this way just seems simpler to do for me.

Thank you again.

Also you see I don't move things around in the admin panel, I use the forms on the website to do it simply because with over 365 columns in my links table, the admin panel is too unwieldy to have to work with, since I payed no attention to how it would look in the admin panel when I added all those fields. Even still, a table with 365 field entries in one place is just too much, so I simply use the form pages on the website which means that if I do move something the templateID will get updated at the same time.

Last edited by:

Westin: May 6, 2009, 9:00 AM
Quote Reply
Re: [Westin] Looking for the CatID In reply to
Hi,

Ok, well the only way you could do what your trying to do, is write a little plugin that would update the record, based on CatLinks.CategoryID field passed in (you can't do it before the link has been added)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for the CatID In reply to
That explains why the templateID doesn't show up unless the record is modified. Bummer!

But if the catID is written to the record from the category chosen, then isn't it also possible to write that to the templateID field in the record as well?

Last edited by:

Westin: May 6, 2009, 9:09 AM
Quote Reply
Re: [Westin] Looking for the CatID In reply to
As I said - to make it work properly, it would need a plugin to hook in on add_link (and modify_link), to update that field appropriatly. Afraid I've not got time to play around with writing it for you though, sorry.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for the CatID In reply to
OIC. Okay, no problem, I'll look for other means to do what I wish to do with it to work within my lack of knowledge.
Quote Reply
Re: [Westin] Looking for the CatID In reply to
Had to wait a few mins to get a reply about another job - so put this together quick for ya. Untested, but will hopefully work. Just install - and when you add a link / modify a link, it should update templateID automatically with the category ID for the link.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for the CatID In reply to
Got this when trying to add a new link:
Code:
Can't use string ("40") as a HASH ref while "strict refs" in use at /home/accounts/admin/Plugins/Update_TemplateID.pm line 39.
Links (1400): Links::environment called at /home/account/admin/Links.pm line 751 with no arguments.
Links (1400): Links::fatal called at /home/account/admin/Plugins/Update_TemplateID.pm line 39 with arguments
(Can't use string ("40") as a HASH ref while "strict refs" in use at /home/account/admin/Plugins/Update_TemplateID.pm line 39.
).
Links (1400): Plugins::Update_TemplateID::do_update_add called at /home/account/admin/GT/Plugins.pm line 144 with arguments
(40).
Links (1400): GT::Plugins::dispatch called at /home/account/admin/Links/Table/Links.pm line 88 with arguments
(GT::Plugins=HASH(0x83a1b48), add_link, CODE(0x82dda48), HASH(0x87fd9c0)).
Links (1400): Links::Table::Links::add called at /home/account/admin/Links/User/Add.pm line 290 with arguments
(Links::Table::Links=HASH(0x87762e8), HASH(0x87fd9c0)).
Links (1400): Links::User::Add::add_link called at /home/account/admin/GT/Plugins.pm line 133 with no arguments.
Links (1400): GT::Plugins::dispatch called at /home/account/admin/Links/User/Add.pm line 45 with arguments
(GT::Plugins=HASH(0x83a1b48), user_add_link, CODE(0x8381118)).
Links (1400): Links::User::Add::handle called at /home/account/admin/GT/Plugins.pm line 133 with no arguments.
Links (1400): GT::Plugins::dispatch called at add.cgi line 26 with arguments
(GT::Plugins=HASH(0x83a1b48), handle_add, CODE(0x81676d0)).
Quote Reply
Re: [Westin] Looking for the CatID In reply to
Try commenting these lines out;

Code:
my $results = shift;
return @args if $results->{error};

..in /admin/Plugins/Update_TemplateID.pm

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Looking for the CatID In reply to
That seems to have done the trick, Thanks Andy, much appreciated.