Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Advice please (link-types)

Quote Reply
Advice please (link-types)
Dear all,

Please let me know if the following approach is correct:

I would like users to identify what TYPE of link they are adding.
The add-form should contain 3 radio-buttons (with only one choice possible):

O website
O classified_ad
O article

When the link is submitted the database should register the link-type.

Which code do I add to the add-template and how precisely, do I add a colom called link_type to the database?

I think this will allow me to present 3 seperate lists of links (one for each link-type) on each category page using: <%if website%>, <%if classified_ad%> and <%if article%>.

The lists of websites and articles will be alphabetically ordered, but I'm wondering if it is possible to have the classified ads ordered chronologically? In Setup there is only one option to set the order of links.

At a later stage I would like to plug in "╦xpire Links" for the classified ads, and "Attachment" for the articles.

All comments and help is very welcome! (I am a beginner)

Cheers, Diederick
Quote Reply
Re: [diederick] Advice please (link-types) In reply to
You would just create a new field, something like;

Code:
type => text
name => link_type
notnull => yes
length => 25

view name => Link Type
DB values => website
classified_ad
article
user values =>website
classified_ad
article

Then, in link.html, have something like;

Code:
<%if link_type eq "website"%>

website link HTML can go here...

<%elsif link_type eq "classified_ad"%>

website HTMl for classified link

<%else%>

website for article

<%endif%>

Hope that helps Smile

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] Advice please (link-types) In reply to
In Reply To:
You would just create a new field, something like;

Code:
type => text
name => link_type
notnull => yes
length => 25


view name => Link Type
DB values => website
classified_ad
article
user values =>website
classified_ad
article

In MySQLMan, I chose Isql_CatLinks > Add Fields > entered the above type, name, notnull & length, and got: Error
MySQL said: You have an error in your SQL syntax near '(25) NOT NULL ' at line 1.
Query: ALTER TABLE lsql_CatLinks ADD link_type TEXT(25) NOT NULL
What have I done wrong? Then, in link.html, have something like;

Code:
<%if link_type eq "website"%>

website link HTML can go here...

<%elsif link_type eq "classified_ad"%>

website HTMl for classified link

<%else%>

website for article

<%endif%>

Hope that helps Smile

Cheers


Thank you Andy for taking the time to point me in the right direction!

Last edited by:

diederick: Jul 8, 2003, 1:13 AM
Quote Reply
Re: [diederick] Advice please (link-types) In reply to
Why do it in MySQLMan?

Goto;

Database > Links > Properties > Add Field

...from there, you will notice all the fields I spoke about. Just populate these with the required values.

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] Advice please (link-types) In reply to
.. as I said, I'm still a beginner... :-)

So I managed to add a new column/field to the table. I also added the <%if...> tags to the link.html.

But I still need to add the radio-buttons to the include_form.html

I added:

<tr><td align="right" valign="top"><%body_font%>Type:&nbsp;</font></td>
<td>
Website: <input type="radio" value="website" name="website"><br>
Classified Ad:<input type="radio" value="classified_ad" name="classified_ad"><br>
Article: <input type="radio" value="article" name="article"><br>
</td></tr>

but this is not correct - what should it be?

PS: Are you the maker of Expire Links plug-in for GT? I will be looking to ad this to the classified_ads.
Quote Reply
Re: [diederick] Advice please (link-types) In reply to
It should be something like;

<tr><td align="right" valign="top"><%body_font%>Type:&nbsp;</font></td>
<td>
Website: <input type="radio" value="website" name="link_type"><br>
Classified Ad:<input type="radio" value="classified_ad" name="link_type"><br>
Article: <input type="radio" value="article" name="link_type"><br>
</td></tr>

Quote:
PS: Are you the maker of Expire Links plug-in for GT? I will be looking to ad this to the classified_ads.

I sure am Smile You may also want to look into my Thumb_Images plugin, which is on final beta version, and should be released either later today, or tomorrow. It will allow people to upload images, and get them auto-thumbnailed. I'm pretty impressed with the outcome so far on the dev install.

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] Advice please (link-types) In reply to
</end shameless ad>
Quote Reply
Re: [Paul] Advice please (link-types) In reply to
Aaah...shudup Tongue You / yogi / Ian / webmaster33 are good enough at them ;)

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: [diederick] Advice please (link-types) In reply to
Many thanks until now.

The last issue is how to get a category page to present the different links-types together in sub-lists?


---------Category page-------------


List of websites
  • website a
  • website b
  • website c


List of Classified Ads
  • classified a
  • classified b
  • classified c


List of Articles
  • article a
  • article b
  • article c

Quote Reply
Re: [diederick] Advice please (link-types) In reply to
The easiest option for doing this is to change build_sort_order_category, in Setup->Build Options to something like:

build_sort_order_category => isNew DESC,isPopular DESC,link_type DESC,Title

The red part is the important part.

I hope this helps.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Advice please (link-types) In reply to
Thank you Ivan (Yogi),

This solution does order the links correctly (first by type and then by title), but I would like to have the types seperated from each other so that I can place headers between them.

Secondly, I would like the classified_ads to be ordered not by title (alphabetically) but by add-date (chronologically). The websites and articles should remain alphabetically ordered.

Once all this is in place I will buy the "Attachment" plug-in from you and the "Expire" plug-in from Andy! Anything for sale Paul? Wink