Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Help! Link display problem

Quote Reply
Help! Link display problem
I designed my database the way to save space, so all form values are stored in a short format.
E.g.: my 'exp_date' field contains value 30, but should be displayed on the links.html page as '4 weeks'

In the Form Information
I have Form Names (7, 14, 21, 30) and Form Values (1 weeks, 2 weeks, 3 weeks, 4 weeks).

How could I reach these form values from my plugin???

Thanks any help in advance.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Help! Link display problem In reply to
Why not use an if statement in link.html?

Something like;

<%if exp_date eq 7%>1 Week
<%elsif exp_date eq 14%>2 Weeks
<%elsif exp_date eq 21%>3 Weeks
<%else%>4 Weeks<%endif%>

Give it a go. Not sure if you need 'eq' or '=' in the statements. 'eq' should work fine, but if it doesn't then give the latter a try.

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: [AndyNewby] Help! Link display problem In reply to
Ideally == as I think the parser evaluates it as a normal perl script would be evaluated.

Last edited by:

RedRum: Feb 8, 2002, 6:17 AM
Quote Reply
Re: [AndyNewby] Help! Link display problem In reply to
Andy, thanks your idea, but this is not a general solution.
I have many forms, and I _have_ the form values which I need in the db definition tables.

That's why I need to access those Form Values somehow.
Template if-else statements are wrong way.

Is it possible anyway to access Form Values directly from LinksSQL?

Thanks,
Webmaster33
Quote Reply
Re: [webmaster33] Help! Link display problem In reply to
What are you attempting to do, I'm not really clear on this?

Are you looking for perl code to access the database or template code?
Quote Reply
Re: [RedRum] Help! Link display problem In reply to
I'm writing a plugin, but I think the problem itself is not a plugin problem.

The links in a category are displayed from the database, without any change, right?
Well, the 'exp_date' field contains value 30, and is displayed as 30, but should be displayed as '4 weeks'.
Do you see now?

Well in LinksSQL there are definition tables, which you can access from Database menu listing Links/Properties with the table editor.
So there are enumerated Form Names like ENUM(7, 14, 21, 30) which has Form Values like (1 week, 2 week, 3 week, 4 week).
The Form Names are stored in the database and the Form Values are displayed in the form.
However when the links are displayed from the database the '30' is displayed instead of '4 week'.

Now, I want to access the Form Names & Form Values to convert the value '30' to '4 week' based on the db definition tables.

I hope it's clear now.

Thanks any help or idea.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Help! Link display problem In reply to
According to what you just said, Andy's code is correct.
Quote Reply
Re: [RedRum] Help! Link display problem In reply to
It is correct I need answer to the following question:
Is it possible to access (read) Form Values from the links db definition table???

If yes, then how?

Webmaster33
Quote Reply
Re: [webmaster33] Help! Link display problem In reply to
You can access it via:

my $values = $DB->table('Links')->cols->{'Column Name'}->{form_values};

and values is an array reference of the form values you entered.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Help! Link display problem In reply to
Alex, thank you very much!
You are great!!!Angelic

That was exactly what I wanted!Wink
I'm happy now Smile

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Help! Link display problem In reply to
Now why didn't I realise that was what you meant and Alex did Blush
Quote Reply
Re: [webmaster33] Help! Link display problem In reply to
Hi,

No problem. $table->cols will give you the 'cols' hash that you see in the .def file, so cols->{ColumName} will give you the column information (which has form_values in it).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Help! Link display problem In reply to
Alex,

You guessed my thought Sly
The answer you replied was answer to my next question I wanted to ask Wink

Thanks again!

P.S.: I didn't find these info in the built-in help. And the PDF contains nothing about these development info. Are there other developer documents available which describe some internal tricks in details?

Finally, I found the info you replied, in Developer Guide on URL: admin.cgi?do=help&topic=/GT/SQL/Table.html#Table_Properties

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...