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

dynamic_404_status works but on detailed

Quote Reply
dynamic_404_status works but on detailed
Hi,

I donīt see any reason why the dynamic_404_status should not work on detailed pages.
I have dynamic pages enabled with rewrite rules. By default if dynamic_404_status is enabled it works with custom pages and category pages.
I changed generate_detailed_page in Page.pm to:

Code:

sub generate_detailed_page {
# --------------------------------------------------------
# This routine build a single page for every link.
#
my ($page, $id, $link, $detail_match);
$page = $IN->param('g') || $ENV{PATH_INFO} || '';
($id) = $page =~ /(\d+)\Q$CFG->{build_extension}\E$/;
if (!$id) {
print "Status: 404" . $GT::CGI::EOL; #<-- changed here
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) });
return;
}
# Fetch the category info if the link is in multiple categories and the category
# the detailed page was accessed from was passed in. This is done so the next
# and previous links are correct.
# Note that due to the URL transformation (Links::clean_output), it isn't
# possible to pass in the CategoryID unless the detailed url is self generated
# (ie. <%detailed_url%> isn't used).
my $cat_id = $IN->param('CategoryID');
if ($cat_id and $DB->table('CatLinks')->count({ LinkID => $id, CategoryID => $cat_id })) {
$link = $DB->table(qw/Links CatLinks Category/)->select({ LinkID => $id, CategoryID => $cat_id })->fetchrow_hashref;
}
else {
$link = $DB->table('Links')->get($id, 'HASH');
}
if (!$link) {
print "Status: 404" . $GT::CGI::EOL; #<-- changed here
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) });
return;
}
print $IN->header();
print Links::Build::build('detailed', $link);
}




So if nobody sees any problems I suggest GT should add the 404 check by default.#

Regards

n || i || k || o

Last edited by:

el noe: Feb 11, 2007, 11:43 AM
Quote Reply
Re: [el noe] dynamic_404_status works but on detailed In reply to
Thanks, I've added dynamic 404's to the detailed pages.

Adrian