Gossamer Forum
Home : Products : Gossamer Links : PHP Front End :

Detail Page On The Fly

Quote Reply
Detail Page On The Fly
Hi,

Is it possible to run with php just like a detailed_page was created by pugdog on CGI version ? For example something like page.php?do=detailed&link_id=1111

Please help
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
Hi,

No body can do this ? Frown

Please help
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
Hi,

You mean something like:

http://gossamer-threads.com/...d&link_id=225840

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Detail Page On The Fly In reply to
Thanks you so much Alex,

Its work, but how to include on detailed page the 'Top Hits' global tags as below:

Code:
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 Detailed_Hits DESC Limit 10');
$sth = $search_db->select ( { isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
if (length $link->{Title} > 22) {
$link->{Title} = substr($link->{Title}, 0, 22) . '...';
}
$output .= Links::SiteHTML::display ('tophits', $link);
}
return $output;
}


Please hlpe and thanks so much.
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
Try this:
Code:
create_function("", '
global $DB, $PREFIX;
$sth = $DB->query("SELECT * FROM ${PREFIX}Links WHERE isValidated = 'Yes' ORDER BY Detailed_Hits DESC LIMIT 10");
$output = '';
while ($link = $sth->fetchrow_hash()) {
if (strlen($link['Title'] > 22) {
$link['Title'] = substr($link['Title'], 0, 22) . '...';
}
$output .= print_page('tophits', $link, array('return_as_string' => 1));
}
return $output;
');

You still need to create a new template 'tophits.html', and format how you want the links to be displayed.

Adrian
Quote Reply
Re: [brewt] Detail Page On The Fly In reply to
Thanks Brewt,

Actually, where suppose i put that code ? On global template ?

Please help and thank you so much.
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
Hi,

I put the code on global template and try to run it but i receive the error message on my header page as below:
Code:
Parse error: parse error, unexpected T_STRING in /home/username/public_html/links/cgi-bin/admin/Links/PHP/Links.inc.php(195) : eval()'d code on line 3

And i also got the error message where i put the code <? $tophits?> with:
Code:
create_function("", ' global $DB, $PREFIX; $sth = $DB->query("SELECT * FROM ${PREFIX}Links WHERE isValidated = 'Yes' ORDER BY Detailed_Hits DESC LIMIT 10"); $output = ''; while ($link = $sth->fetchrow_hash()) { if (strlen($link['Title'] > 22) { $link['Title'] = substr($link['Title'], 0, 22) . '...'; ) $output .= print_page('tophits', $link, array('return_as_string' => 1)); ) return $output; ');

Please help and thanks so much.
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
You should enter it as a global.

A correction to the code:

Code:
create_function("", '
global $DB, $PREFIX;
$sth = $DB->query("SELECT * FROM ${PREFIX}Links WHERE isValidated = \"Yes\" ORDER BY Detailed_Hits DESC LIMIT 10");
$output = "";
while ($link = $sth->fetchrow_hash()) {
if (strlen($link["Title"]) > 22) {
$link["Title"] = substr($link["Title"], 0, 22) . "..."; }
$output .= print_page("tophits", $link, array("return_as_string" => 1)); }
return $output;
');

fixed, and btw, to use that global, you call it using: <?$global_name()?>

okay, I forgot how stupid PHP can be. The ending braces with create_function() need to be on the same line as the last expression! Tested it this time Smile

Adrian

Last edited by:

brewt: Jan 9, 2003, 1:29 AM
Quote Reply
Re: [brewt] Detail Page On The Fly In reply to
Thanks brewt,

but i still got an error message:

Quote:
Parse error: parse error, unexpected '{' in /home/username/public_html/links/cgi-bin/admin/Links/PHP/Links.inc.php(195) : eval()'d code(12) : runtime-created function on line 6

Please help

Last edited by:

reenee: Jan 6, 2003, 9:31 PM
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
Anybody ?

Please help.
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
Try it again, I fixed a syntax error in that code.

Adrian
Quote Reply
Re: [brewt] Detail Page On The Fly In reply to
Still got an error:

Parse error: parse error, unexpected ')' in /home/username/public_html/links/cgi-bin/admin/Links/PHP/Links.inc.php(195) : eval()'d code(12) : runtime-created function on line 8

Please help.
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
It should work now!

Adrian
Quote Reply
Re: [brewt] Detail Page On The Fly In reply to
I was just going to point out that the bracket around strlen was in the wrong place :) ...but I have no idea about php so was hesitant about posting.

Last edited by:

Paul: Jan 9, 2003, 1:32 AM
Quote Reply
Re: [reenee] Detail Page On The Fly In reply to
What about this Frown