Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

[ FREE PLUGIN ] ULTRAGlobals - Collection of Globals and routines

(Page 4 of 10)
> > > >
Quote Reply
Re: [Andy] [ ULTRAGlobals ] Ideas please In reply to
Hi
Andy

A global to include home cat├ęgories on another pages.

Code:
sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Name');
my $sth = $cat_db->select ( { FatherID => 0}, ['Full_Name','Name','Number_of_Links'] );
my $output="";
while (my ($root_cat,$full_name,$number_of_links) = $sth->fetchrow_array) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<li><a href="$CFG->{build_root_url}/$url/">&nbsp;$full_name</a>($number_of_links)</li>~;
}
return $output;
}
Quote Reply
Re: [dujardin] [ ULTRAGlobals ] Ideas please In reply to
Hi,

Thanks, I'll add that in.

Think I'll change it so its a loop'able tag, i.e:

Code:
<ul>
<%loop main_categores%>
<li><a href="<%URL%>">&nbsp;<%Full_Name%></a>(<%Number_of_Links%></li>
<%endloop%>
</ul>
..as this will give more control over how you lay it out (because of it being in a Plugin , its not as easy as just editing a global, cos it will get overwritten when yougrade the plugin 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: [dujardin] [ ULTRAGlobals ] Ideas please In reply to
Hi,

Version 2.1.0 is now available from our site Smile

Code:
<%Plugins::ULTRAGlobals::Get_Root_Categories()%>
<ul>
<%loop root_cat_loop%>
<li><a href="<%URL%>">&nbsp;<%Full_Name%></a>(<%Number_of_Links%></li>
<%endloop%>
</ul>

Enjoy =)

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] [ ULTRAGlobals ] Ideas please In reply to
hi
With the global Latest_New_Links

The date is displaying in wrong format.

the tag is <%Add_Date%>

in date setup:
i have date_user_format = %ddd% %dd% %mmm% %yyyy%

<%Add_Date%> look like Sun 10 Feb 2008
in all page displaying links.html template

but with the global Latest_New_Links

<%Add_Date%> look like 2008-02-10

thx
Quote Reply
Re: [dujardin] [ ULTRAGlobals ] Ideas please In reply to
Hi,

You should be able to just convert this in the templates:

Code:
<%GT::Date::date_transform($Add_Date,'%yyyy%-%mm%-%dd%',$date_user_format)%>

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] [ ULTRAGlobals ] Ideas please In reply to
Hi Andy,

1. I just tried the new code with the escape_html but I get an error:

Unknown Tag: '($slog_query)'

Code:
<%Plugins::ULTRAGlobals::Top_Search_Words('10')%>
<%if search_logger_top_words.length%>
<ul>
<%loop search_logger_top_words%>
<li><a href="<%config.db_cgi_url%>/search.cgi?query=<%escape($slog_query)%>"><%escape_html($slog_query)%></a></li>
<%endloop%>
</ul>
<%else%>
No search terms yet
<%endif%>



2. Could you although please include the last links in a category.
There is already new links in a category

Code:
<%Plugins::ULTRAGlobals::New_Links_By_Category($ID)%>
<%loop new_links_in_this_cat%>
<%include link.html%>
<%endloop%>

But this would show nothing, when there is no new flag...

Thanks
Matthias

Matthias
gpaed.de

Last edited by:

Matthias70: Mar 30, 2008, 2:04 PM
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Matthias70 wrote:
Hi Andy,

1. I just tried the new code with the escape_html but I get an error:

Unknown Tag: '($slog_query)'

Code:
<%Plugins::ULTRAGlobals::Top_Search_Words('10')%>
<%if search_logger_top_words.length%>
<ul>
<%loop search_logger_top_words%>
<li><a href="<%config.db_cgi_url%>/search.cgi?query=<%escape($slog_query)%>"><%escape_html($slog_query)%></a></li>
<%endloop%>
</ul>
<%else%>
No search terms yet
<%endif%>

Thanks
Matthias

You should use something like this <%escape_html slog_query%> instead of <%escape_html($slog_query)%>.

Regards.

UnReal Network
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

Quote:
2. Could you although please include the last links in a category.
There is already new links in a category

Not 100% sure what you are asking for me. Are you trying to make it so that if no new links exist, you can show something? If so, then this should work:

Code:
<%Plugins::ULTRAGlobals::New_Links_By_Category($ID)%>
<%if new_links_in_this_cat.length%>
<%loop new_links_in_this_cat%>
<%include link.html%>
<%endloop%>
<%else%>
Sorry, there are no new links.
<%endif%>

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: [DeadMan] [ ULTRAGlobals ] Ideas please In reply to
DeadMan wrote:

You should use something like this <%escape_html slog_query%> instead of <%escape_html($slog_query)%>.

Regards.

Hi Deadman,
thanks for your help, now I'm using this code

Code:
<%Plugins::ULTRAGlobals::Top_Search_Words('5')%>
<%if search_logger_top_words.length%>
<%loop search_logger_top_words%>
<p><a href="<%config.db_cgi_url%>/search.cgi?query=<%escape_html slog_query%>"><%escape_html slog_query%></a></p>
<%endloop%>
<%else%>
No search terms yet
<%endif%>

@ Andy the wrong code in my post above is from the Ultra Globals Readme

Andy wrote:
Not 100% sure what you are asking for me. Are you trying to make it so that if no new links exist, you can show something?


Hi Andy,
I'm using this global, to show the last 5 links on my whole site.
Code:
sub {
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY ID DESC', 'LIMIT 5');
my $sth = $table->select( { isNew => 'Yes', isValidated => 'Yes' });
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { Lastlinks5_loop => \@output };
}

It would be great, to have this for some categories.
Last links in category instead of new links in category

Cause when I use this global and there are no new links in this category, there is no output
Code:
<%Plugins::ULTRAGlobals::New_Links_By_Category($ID)%>
<%loop new_links_in_this_cat%>
<%include link.html%>
<%endloop%>

But if there are the last links shown, they are shown even, when they are older...

I hope you understand, what I mean.
Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

I'm confused, thought you were using UltraGlobals, not your own global? Tongue

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] [ ULTRAGlobals ] Ideas please In reply to
Andy wrote:
Hi,

I'm confused, thought you were using UltraGlobals, not your own global? Tongue

Cheers

Hi Andy,
the global was only an example (whole site), for what I would like to see for categories in the Ultra Globals :-)

Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

I'm still confused :/

Are you saying you would like to see the global you posted, added to UltraGlobals? Sorry, not being too bright today <G>

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] [ ULTRAGlobals ] Ideas please In reply to
Andy wrote:
Hi,

I'm still confused :/

Are you saying you would like to see the global you posted, added to UltraGlobals? Sorry, not being too bright today <G>

Cheers

Cool O.K. Another try

I would like to see a global like this in ultra globals

Code:
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID)%>
<%loop last_links_in_this_cat%>
<%include link.html%>
<%endloop%>
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

Ahhh- I get you now =)

I'll see what I can do.

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: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

Version 2.2.1 now has this feature:

Code:
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID)%>

<%if last_links_in_this_cat.length%>
<%loop last_links_in_this_cat%>
<%include link.html%>
<%endloop%>
<%else%>
<p>No links were found</p>
<%endif%>

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] [ ULTRAGlobals ] Ideas please In reply to
Andy wrote:
Hi,

Version 2.2.1 now has this feature:

Code:
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID)%>

<%if last_links_in_this_cat.length%>
<%loop last_links_in_this_cat%>
<%include link.html%>
<%endloop%>
<%else%>
<p>No links were found</p>
<%endif%>

Hi Andy,
I'm getting this error


Code:
GT::SQL::Table (17412): Wrong argument passed to this subroutine. No category id passed to children at admin/Links/Table/Category.pm line 476.


And can I show only 5 last links with
Code:
<%Plugins::ULTRAGlobals::Last_Links_By_Category(5,$ID)%>

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

Quote:
Hi Andy,
I'm getting this error


Code:

GT::SQL::Table (17412): Wrong argument passed to this subroutine. No category id passed to children at admin/Links/Table/Category.pm line 476.

How are you calling it? Also, which template.

Quote:
And can I show only 5 last links with
Code:
<%Plugins::ULTRAGlobals::Last_Links_By_Category(5,$ID)%>

Not with this version - I may add it in though (just wanna see what the bug above is (or isn't))

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] [ ULTRAGlobals ] Ideas please In reply to
Hi Andy,
I put it into the rightsidebar and was calling it with the category number of a subcategory

Code:
<h4>Headline</h4>
<%Plugins::ULTRAGlobals::Last_Links_By_Category($676)%>

<%if last_links_in_this_cat.length%>
<%loop last_links_in_this_cat%>
<%include link.html%>
<%endloop%>
<%else%>
<p>No links were found</p>
<%endif%

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

Looks like your trying to pass in a variable :P

<%Plugins::ULTRAGlobals::Last_Links_By_Category($676)%>

If 676 is a category number, just do:

<%Plugins::ULTRAGlobals::Last_Links_By_Category('676')%>

That should sort it.

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: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

Version 2.2.2 now has the ability to pass in a number, as a second parameter. New version can be download from our site.

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!
Post deleted by Matthias70 In reply to
Quote Reply
Re: [Andy] [ ULTRAGlobals ] Ideas please In reply to
Hi Andy,
I tried
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID,'3')%>
and
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID,3)%>
and
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID,"3")%>

but it still shows all links?

Matthias

Matthias
gpaed.de

Last edited by:

Matthias70: Mar 31, 2008, 11:25 AM
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Matthias70 wrote:
Hi Andy,
I tried
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID,'3')%>
and
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID,3)%>
and
<%Plugins::ULTRAGlobals::Last_Links_By_Category($ID,"3")%>

but it still shows all links?

Matthias


Hi Andy,
I still can't limit the number of last links in a category!

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] [ ULTRAGlobals ] Ideas please In reply to
Hi,

You definatly using the most recent version? I just looked at the file on our site, and the code should work fine.

Code:
sub Last_Links_By_Category {

my $cat = $_[0];
my $limit = $_[1] || 5;

my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;

my $db_obj = $DB->table('Links','CatLinks','Category');
$db_obj->select_options ("ORDER BY ID DESC Limit $limit");


my $sth = $db_obj->select (['Links.*'], GT::SQL::Condition->new(['CategoryID', 'IN', $all_ids], ['isValidated', '=', 'Yes'] ) ) || die $GT::SQL::error;

my $cond = GT::SQL::Condition->new('CategoryID', 'IN', $all_ids);
my $cond2 = GT::SQL::Condition->new('isValidated','=','Yes');
my $sth = $db_obj->select (['Links.*'], $cond, $cond2 ) || die $GT::SQL::error;


# print $IN->header();
# use Data::Dumper;
# print Dumper($sth);

my @cats;
while (my $hit = $sth->fetchrow_hashref) {

if ($CFG->{build_detailed}) { $hit->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $hit->{ID} ); }

if ($hit->{isNew} eq "Yes") { $hit->{isNew} = 1; } else { $hit->{isNew} = 0; }
if ($hit->{isPopular} eq "Yes") { $hit->{isPopular} = 1; } else { $hit->{isPopular} = 0; }
if ($hit->{isChanged} eq "Yes") { $hit->{isChanged} = 1; } else { $hit->{isChanged} = 0; }

push @cats, $hit;
}

return { last_links_in_this_cat => \@cats }

}

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] [ ULTRAGlobals ] Ideas please In reply to
Andy wrote:
Hi,

You definatly using the most recent version? I just looked at the file on our site, and the code should work fine.

Hi Andy,
I just downloaded 2.2.2 again and the limit is not working at all.
It shows still all links :-(

Matthias

Matthias
gpaed.de
> > > >