Gossamer Forum
Home : Products : Gossamer Links : Discussions :

newlinks display

Quote Reply
newlinks display
I saw this glodal in resources and tried it. But not working.

==========================================

Create a global called "newlinks" with the following description:

sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 5');
$sth = $search_db->select ( { isNew => 'Yes', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}

The number "5" can be changed to whatever number of new links you want the global to display. Use a <%newlinks%> tag to display a list of your directory's newest links.
=======================================

I am getting this error like link1.html is not found at line 208 SITEHTML.pm. Then i created a file named link1.html. But not working?

What code i have to keep on the home page to get the new links displayed?

Thanks.
Quote Reply
Re: [hegu] newlinks display In reply to
You need to add a template 'link1.html' to your default template directory for this global to work. The error message you get tells you that this file is not there (or at least not in the correct directory).

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] newlinks display In reply to
I am using 'mint' template set. I created a file with name 'link1.html' in that directory after i got this error. But still not displaying newlinks.

I put this code:

<%newlinks%> on my homepage.

thanks.
Quote Reply
Re: [hegu] newlinks display In reply to
Do you get plain nothing, or do you get an error message, and if so what is the precise error message?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] newlinks display In reply to
Nothing. home page displaying as usual (dynamic mode) with categories. actually i use static mode for my web site. First i checked dynamic mode to see how it looks like. No error messages.

thanks.

Last edited by:

hegu: May 9, 2003, 4:23 AM
Quote Reply
Re: [hegu] newlinks display In reply to
In your link1.html template you need to add the information that you want to be displayed for each new link. Try copying the html from link.html into link1.html and then you can modify it to get exactly what you want. Alternatively, you can just change link1 to link in the global if you just want to display exactly what you have for the link template.
Quote Reply
Re: [afinlr] newlinks display In reply to
1. I saved link.html to link1.html. ( i didn't change to link.html from link1.html in global)

2. I put this code on my homepage:

<%newlinks%>

AND I TRIED Tthis too:

<%if newlinks%>
<%newlinks%><%endif%>

Not displayed any newlinks.(Yes there are some 15 newlinks)

Thanks.
Quote Reply
Re: [hegu] newlinks display In reply to
Well I can't see what could be wrong. Try using this global and report back what the output looks like.

sub {
# Displays the newest links on the home page.
my ($sth,$link);

my $output = "<b>New Links</b><br>";
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 5');
$sth = $search_db->select ( { isNew => 'Yes', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {

$output .= "<br>----<br>";
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}

Last edited by:

afinlr: May 9, 2003, 6:16 AM
Quote Reply
Re: [hegu] newlinks display In reply to
I just tried the global. Works fine.

It doesn't return anything when the query was unsuccessful for some reason.
This may be several reasons:
  1. Add_Date column is not valid, or contain invalid value
  2. isNew column has No value set for all records
  3. isValidated column has No value set for all records, or at least for those isNew column records which has Yes value set.
- use the 'link' instead of 'link1' for testing phase to close out this reason
- Do you use MySQL database?
You should start MySQLMan, and check Links table, if a record you think should be displayed, matches all the 3 criteria listed above.

If that doesn't help, I've no more 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] newlinks display In reply to
Hi Webmaster33,

I checked all three.everything is OK.

So i tried affinlr global. It worked.

Hi affinlr,

The global worked and out put was like Link ---- Link ---- Link

Thanks both of you.

Why the first global working for everybody didn't work for me????
Quote Reply
Re: [hegu] newlinks display In reply to
Strange! There wasn't changed any important part! Both globals should work for you! If second works, first should also work!

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] newlinks display In reply to
Hi,

Every link that is displayed from the above global has all three 'new', 'updated' and 'popular' tags. actually they are just added.how can they be updated and popular?

Why?

thanks.
Quote Reply
Re: [hegu] newlinks display In reply to
Since you now use link1.html file, the process isn't going though standard site_html_link() function in SiteHTML.pm.
Therefore you miss some operations.

The question is, why do you want new link1.html? Do you want to change lookout? How much? What you need from standard link features?, etc...

Add these codes before the while loop in the global:
Code:
(defined $link->{'isNew'} and ($link->{'isNew'} eq 'Yes')) ? ($link->{'isNew'} = 1) : ($link->{'isNew'} = 0);
(defined $link->{'isChanged'} and ($link->{'isChanged'} eq 'Yes')) ? ($link->{'isChanged'} = 1) : ($link->{'isChanged'} = 0);
(defined $link->{'isPopular'} and ($link->{'isPopular'} eq 'Yes')) ? ($link->{'isPopular'} = 1) : ($link->{'isPopular'} = 0);
(defined $Links::USER->{Username} and ($link->{'LinkOwner'} eq $Links::USER->{Username})) ?
($link->{'isLinkOwner'} = 1) : ($link->{'isLinkOwner'} = 0);
Depending if you want more feature, like ratings displayed, may add more codes to the global.

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] newlinks display In reply to
Quote:
In your link1.html template you need to add the information that you want to be displayed for each new link. Try copying the html from link.html into link1.html and then you can modify it to get exactly what you want. Alternatively, you can just change link1 to link in the global if you just want to display exactly what you have for the link template.
Quote:
The question is, why do you want new link1.html? Do you want to change lookout? How much? What you need from standard link features?, etc...
As affinlr said to do either one (lnk1 to link in the global or saving link.html as link1.html), i just went for the second option. There is no particular intention. Both has same lay out. And i just changed the link1 to link in the global. It is working fine. Thank you.
Quote Reply
Re: [hegu] newlinks display In reply to
Now i have another problem:

I have 111 links. As new links it should display 102,103,104,105,106,107,108,109,110,111.

But the global showing in this order:

111,110,100,101,102,103,104,105,106,107

108 and 109 also have isNew set to YES. Any ideas?

Thanks. (is there any end to my problems?Frown)
Quote Reply
Re: [hegu] newlinks display In reply to
This is the global i am using:

----------------------------------

sub {
# Displays the newest links on the home page.
my ($sth,$link);

my $output = "<b><font face=Verdana color=#ff0000><center>Recent 10 New Links</center></font></b><br>";
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 10');
$sth = $search_db->select ( { isNew => 'Yes', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {

$output .= "<br>";
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}

------------------------------------

thanks.
Quote Reply
Re: [hegu] newlinks display In reply to
Links are ordered in descending Add_date order.
Did you check what are in Add_date fields of those links? You should check visually using MySQLman...

Also you description is confusing. The 108 & 109 links were't showed?

P.S.: if you reply to yourself post, I will not get email notice, that you posted. Reply to such post, from where you await answer...

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] newlinks display In reply to
Link dates: from 110 to 111

------------

111 : 2003-05-07( Add_Date) 2003-05-08(Mod_date)
110 : 2003-05-07 2003-05-08
109 : 2003-05-06 2003-05-06
108 : 2003-05-06 2003-05-06
107 : 2003-05-06 2003-05-06
106 : 2003-05-06 2003-05-06
105 : 2003-05-06 2003-05-06
104 : 2003-05-06 2003-05-06
103 : 2003-05-06 2003-05-06
102 : 2003-05-06 2003-05-06
101 : 2003-05-06 2003-05-06
110 : 2003-05-06 2003-05-06

-----------------

Quote:


Also you description is confusing. The 108 & 109 links were't showed?


Yes. 108 and 109 are not displayed at all. They are displayed in this order where i put <%newlinks%> tag: 110,111,100,101,102,103,104,105,106,107

thanks.
Quote Reply
Re: [hegu] newlinks display In reply to
Hehe Smile
Except 1 date, all dates are the same. So SQL doesn't sort those which are the same.

Ok. Use this to correct:
$search_db->select_options ('ORDER BY Add_Date DESC, ID DESC Limit 10');

Quote:
108 and 109 are not displayed at all
I don't see reason why not to display.
Are their isValidated set to 'Yes' ???

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] newlinks display In reply to
Great. It worked. Now links are displaying from 102 to 111.SmileSmileSmile

For who might want to use this ; Here is the final global:

==============================

sub {
# Displays the newest links on the home page.
my ($sth,$link);

my $output = "<b><font face=Verdana color=#ff0000><center>Recent 10 New Links</center></font></b><br>";
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Add_Date DESC, ID DESC Limit 10');
$sth = $search_db->select ( { isNew => 'Yes', isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {

$output .= "<br>";
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}

=========================

Keep this tag where you want to display new links:

========================

<%if newlinks%>
<%newlinks%><%endif%>

========================

Is this correct webmaster33?

Thanks for yout time. ReallySmile
Quote Reply
Re: [hegu] newlinks display In reply to
It's fine for me if it's fine for you. Wink Glad that it works. Cool

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...