Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Pull Specific links onto main page

Quote Reply
Pull Specific links onto main page
Hi,

I've got an entire website being run by LSQL, and the main LSQL page is the home page. What I'd like to do it to do is pull data from certain links onto the home page. Lets say I create a new template called include_highlight.html and I put the information that I want to show about that link in the template, then include that in home.html.

Now, how do I tell the script to only return results for the one record I choose? Would it be a search result? How would that work?

Sorry, I wish I knew more about how this worked, but my brain just doesn't quite get the whole coding thing... Smile
Quote Reply
Re: [Evoir] Pull Specific links onto main page In reply to
Try this global, load_link($ID):
Code:
sub {
my $id= shift;
my $link = $DB->table('Links')->get($id);
require Links::SiteHTML; # not sure if needed
return $link->{ID} ? Links::SiteHTML::display('your_template_name_here', $link) : '';
}

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Pull Specific links onto main page In reply to
Yogi,

Thanks for the reply! Sorry I wasn't so clear in my first post. I do appreciate the help. I'll try to explain it better this time.

On the home page have 1 or two calls to this global, each call identifying the link number we want to pull. I'd like to set the global up once, and then change what link we want to see on the home page (within it's special template, of course) and simple change the number in the template once a week or so.

I also am so dumb about code, I am not sure-- it seems like with the global you offered, All I'd do on the template is call <%load_link%> and the global defines which link, right? (Would I replace the ? with the link number?)

Anyway, if I could identify which link in the template, that would be better. I'm going to have a even a more non-techie person updating the templates as time goes on. I wouldn't want him to have to go into the globals.
Quote Reply
Re: [Evoir] Pull Specific links onto main page In reply to
You'd have to specify the ID of the link, as in

<%load_link($ID)%>

Does that make sense?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Pull Specific links onto main page In reply to
Ok, So I created a template, and called it "include_link_image.html". In that template, the following code:
<a href="<%build_root_url%>/Details/<%ID%>.shtml" target="<%Target%>"><img src="/<%db_cgi_url%>/jump.cgi?ID=<%ID%>&view=Image" alt="<%ImageAlt%>" border="0" align="left"></a>


Basically showing the image from that link on another page, and when a user clicks on the image, they get taken to the detailed page of the link)

Then, I created a global called "load_link" and put the following code in it:
sub {
my $id= shift;
my $link = $DB->table('Links')->get($id);
require Links::SiteHTML; # not sure if needed
return $link->{ID} ? Links::SiteHTML::display('include_link_image.html', $link) : '';
}


And put the following code on home.html
<%load_link($537)%>

and LinksSQL does not build anything for it. What am I doing wrong?

Last edited by:

Evoir: Feb 8, 2003, 1:49 PM
Quote Reply
Re: [Evoir] Pull Specific links onto main page In reply to
You are meant to be passing in a tag or a number, you seem to be mixing both.

Either use $ID or 537 but not $537 :)
Quote Reply
Re: [Paul] Pull Specific links onto main page In reply to
ahhh. fixed that. I also should not have included the .html within the global.

Now it mostly works, but having trouble showing the image. It does show the other information that I put in the template (and links correctly to the detailed page. The image just doesn't show. (broken)

I'll keep tinkering with it. If either of you have a suggestion, I am all ears. Thanks for the help so far. Crazy