Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Possible to do a link 'add to short list' ?

Quote Reply
Possible to do a link 'add to short list' ?
Hiya,
Is it possible to do a "Add to shortlist" type of thing where it would pass over the link name / url to detailed page and some other column values throughout the site in a tab down the side somewhere?

Anyone know how I could do this? I'd assume I'd need to do some seperate php throughout the site and possibly a seperate page entirely to list the short list, but not sure where i'd start in doing this.

Anyone done this before and wouldn't mind sharing the code or could put me in the right direction?

Cheers
Quote Reply
Re: [ryanv2] Possible to do a link 'add to short list' ? In reply to
There is already a bookmark feature. However, if you want display the user's bookmarks in the sidebar you'll have to write a template global for that.

Try out the bookmark function and let us know if that's what you mean. If so, then somebody can help you write a global for it.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Possible to do a link 'add to short list' ? In reply to
In Reply To:
There is already a bookmark feature. However, if you want display the user's bookmarks in the sidebar you'll have to write a template global for that.

Try out the bookmark function and let us know if that's what you mean. If so, then somebody can help you write a global for it.


cheers for the fast reply Fuzzy.

Bookmark fuction? not aware of that isnide links, mind giving a example?

But yer, i'd need it to be displayed in a side bar, if you could give me a hand with the global that would be great.

Cheers
Quote Reply
Re: [ryanv2] Possible to do a link 'add to short list' ? In reply to
Check out the official demo here:

http://demo.gossamer-threads.com/linkssql/

under each link listing, there is a 'bookmark it' link. You'll need to create an account to use it though.

The global will look something like:

Code:
sub {
return unless $USER;

my $max = shift || 10;

my $db = $DB->table(qw/Links Bookmark_Links/);
$db->select_options("ORDER BY RAND() LIMIT $max");
my $rec = $db->select(GT::SQL::Condition->new(
"Bookmark_Links.my_user_username_fk" => "=" => $USER->{Username},
"Links.isValidated" => "=" => "Yes"
)
)->fetchall_hashref();

return { bookmark_loop => $rec };
}

name it "load_bookmark_sidebar".

In your template (ie, in include_right_sidebar.html), use:

Code:
<%load_bookmark_sidebar(10)%>

<%if bookmark_loop.length%>
Quick Links:
<ul>
<%loop bookmark_loop%>
<li><a href="<%URL%>"><%Title%></a></li>
<%endloop%>
</ul>
<a href="<%config.db_cgi_url%>/bookmark.cgi">Show all</a>
<%endif%>

load_bookmar_sidebar takes one optional argument, which is the number of links to display.

Mind you, all of this is untested, but it should be enough to get you started.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Possible to do a link 'add to short list' ? In reply to
Cheers Fuzzy.

I assume this would work with 2.1.2? think i might of posted this in the wrong forum, sorry.

But thats almost perfect (apart from having to be logged in to use it), is there a way of doing it where the user does't need to be logged in?

Would like to do it where if the user isn't logged in it'll store it as the user is browsing about and hopefully save it via a cookie or something if they leave.

Or allow them to store it by creating an account and being logged in, in which case they are stored forever or for a set period of time else it just stores while they are browsing about?

Cheers for the fast reply again fuzzy, appreciate your help on this one.
Quote Reply
Re: [ryanv2] Possible to do a link 'add to short list' ? In reply to
No, not using the built-in bookmark system. Andy (of UltraNerds) has a clone that will work using cookies if I'm not mistaken.

Actually, I think the bookmark function was only added in 3.x.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Possible to do a link 'add to short list' ? In reply to
Ah so can't use it then if it's not in 2.1.2 :(

Can't really afford to shell out proberly $50 or so for a plugin right now.

Any ideas on how i could do this beyond that?

perhaps a ajax/js solution maybe?