Gossamer Forum
Quote Reply
loop on detailed pages
I use some loops and they runs fine, except on the detailed.html and modify pages.

This global does not work on detailed pages:

sub {
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY ID DESC', 'LIMIT 10');
my $sth = $table->select ({ top5 => 'Yes' } );
my @output;
while (my $link = $sth->fetchrow_hashref) {
$link->{Title} = (length $link->{Title} > 30) ? substr($link->{Title},0,30) . ' ...' : $link->{Title};
push (@output, $link);
}
return { top5_loop => \@output };
}



What can be the reason that I canīt use this global at detailed and modify?

This global runs fine on all pages:

sub {
my $tags = shift;
my $table = $DB->table('Category');
$table->select_options ('ORDER BY sort DESC', 'LIMIT 20');
my $sth = $table->select ( { FatherID => '0' } );
my @output;
while (my $link = $sth->fetchrow_hashref) {
$link->{Name} = (length $link->{Name} > 30) ? substr($link->{Name},0,30) . ' ...' : $link->{Name};
push (@output, $link);
}
return { Lastlinks5_loop => \@output };
}

Itīs nearly the same, just to show categories instead links.

Any idea?

--
Michael Skaide

http://www.skai.de

--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [Sir Up] loop on detailed pages In reply to
Just bring it back on top.

--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [Sir Up] loop on detailed pages In reply to
What happens on the detailed/modify page? Add a <%GT::Template::dump%> after the global call and see if the top5_loop template is set.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] loop on detailed pages In reply to
Hi Alex,

on the detailed-pages I get only presented the value of the singgle-item-field, like 'Yes' or 'No'.
On the other pages I will get a listing of all the records.

The global is mentioned when I insert <%GT::Template::dump%> , but the result is just the selected value of the items-field, not the listing which the global should display.

--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [Sir Up] loop on detailed pages In reply to
Can you post an example of what top5_loop looks like from gt::template::dump? Also, try renaming the return, i.e.

return { new_top5_loop => \@output };

just in case you have some other global overwriting it.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] loop on detailed pages In reply to
Hi Alex,

I have an extra site (include_left_col.html) which contains the different loops (Top-Seller, Random-New, Random Special-Price ...). This site is included as a column in all links-templates in this way
<%include include_left_col.html%>
so the source for the informations is the same for all pages. All loops will be displayed proper on all pages, except Top-Seller on the detailed-page.

On the detailed-page <%GT::Template::dump%> shows

top5 Yes

On the other pages I get the right results

top5 $VAR = 'CODE(0x8571578)';
top5_loop $VAR = [
{
'Description' => 'Happy Bike Gift Box<br>
Gesche ...... snipp ......
'isValidated' => 'Yes'
}
];


Thank you for your help!



--
Michael Skaide

http://www.cycle24.de