Gossamer Forum
Quote Reply
Category table ...
Hello,

I have a problem with the use of the Category table.

I added a AllowLinks column.
Enumeration Type (Yes, No).

I added this Gobal on the include_form.html page.

<%AllowLinks(ID)%>

sub {
my $id = shift;
my $cat = $DB->table('Category')->get($id);
return $cat ? $cat->{AllowLinks} : ' ';
}

It turns over, for example : $VAR = 'CODE(0x84908c4)';

I would like, that it turns over the value like Yes or No.

Then, I would like to use a condition on the add.html page or include_form.html :

<%if AllowLinks eq 'Yes'%>
---
<%else%>
---
<%endif%>

I sought an answer on the forum, but, I did not find an answer.

Somebody can help me?

Thank you

Mick
Quote Reply
Re: [mick31] Category table ... In reply to
Firstly you need

<%AllowLinks($ID)%>
Quote Reply
Re: [afinlr] Category table ... In reply to
Hello Afinlr,

Thank you to have corrected my error.


But, the problem is always.
I believe that this evaluation is not possible on the include_form.hrml page.

You can confirm?

Thank you,

Mick

Last edited by:

mick31: Sep 21, 2004, 12:31 AM
Quote Reply
Re: [mick31] Category table ... In reply to
Try;

Code:
<%AllowLinks($ID)%>
<%if ALLOWLINKS == 1%>
... do stuff here...
<%endif%>

Code:
sub {
my $id = $_[0];
my $cat = $DB->table('Category')->get($id);
$cat->{AllowLinks} ? return { ALLOWLINKS => 1 } : return { ALLOWLINKS => 0 };
}

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] Category table ... In reply to
Hello Andy,

Thank you for your answer.

But, the code poses problems to me.

It always gives 1 like value.

It is necessary to modify the column (Yes, No) by (1, 0) ?

You have an idea?

Mick

Last edited by:

mick31: Sep 21, 2004, 6:19 AM
Quote Reply
Re: [mick31] Category table ... In reply to
Try changing it to a CHAR, with a SELECT form field... and then put Yes/No 1/0 in the text area boxes (show values, and database values, in respective order).

Hope that helps.

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] Category table ... In reply to
Thank you Andy,

He seems to work maintenand correctly.

You must add it in the resources of your site…

Mick
Quote Reply
Re: [mick31] Category table ... In reply to
Great Cool

Quote:
You must add it in the resources of your site…

Will do :) (when I get some time =)).

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] Category table ... In reply to
Hello Andy,

I found a problem with the Global

1/ The user comes from a category .
If the user selects a category which is equal to 0 or 1, the condition is correctly checked.


2/ Now, the user is on the add.html page to propose the link (ALLOWLINKS => 1)

It does not supplement the data correctly then an error message is turned over.

The Global always turns over 0 (the condition is not checked).
It should continue to return 1.

You have an idea?

Mick