Gossamer Forum
Home : Products : Links 2.0 : Customization :

Download Mod question...

Quote Reply
Download Mod question...
I installed Download Mod, I want change title look like to ...

Top : english : english

change to Top: non-english : non-english

how to edit the detail.cgi ?

# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n[/url]";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}

# ========================================================

eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.

sub main {
# --------------------------------------------------------
%in = &parse_form();

my (%rec) = &get_record ($in{'ID'});

unless ($in{'ID'}) {
&html_print_headers;
print &site_html_detailed_error ("Kein Link angegeben."); #future versions will load a form instead of an error
}
elsif ($rec{$db_key} eq $in{'ID'}) {
$title_unlinked = &build_unlinked_title ("$rec{'Kategorie'}/$rec{'Titel'}");
$title_linked = &build_linked_title ("$rec{'Kategorie'}/$rec{'Titel'}");
$thiscat = $rec{'Kategorie'};
&html_print_headers;
print &site_html_detailed (%rec);
}
else {
&html_print_headers;
print &site_html_detailed_error ("Link $in{'ID'} nicht gefunden.");
}
}

###
# Can't require nph-build -- have to copy this stuff :-)
###

sub build_linked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with each part linked to the respective section.

my $input = shift;
my (@dirs, $dir, $output, $path, $last);

@dirs = split (/\//, $input);
$last = &build_clean(pop @dirs);

$output = qq| <A HREF="$build_root_url/">­¶­º</A> :|;
foreach $dir (@dirs) {
$path .= "/$dir";
$dir = &build_clean ($dir);
$output .= qq| <A HREF="$build_root_url$path/">$dir</A> :|;
}
$output .= " $last";

return $output;
}

sub build_unlinked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up by section.
# Useful for printing in the title.

my $input = shift;
my (@dirs, $dir, $output);

@dirs = split (/\//, $input);

$output = qq|$build_site_title : |;

foreach $dir (@dirs) {
$dir = &build_clean ($dir);
$output .= " $dir :";
}
chop ($output);
return $output;
}

###
# End of stuff we copied from nph-build.
###

sub error {
# ------------------------------------------
#
print "Content-type: text/html\n\n";
print "Error: $_[0]\n";
exit;
}
Quote Reply
Re: [leo2200] Download Mod question... In reply to
Quote:
Top : english : english

change to Top: non-english : non-english

I'm lost Unsure

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] Download Mod question... In reply to
sorry, i want change the title link to non-english mod, but i use the download mod detail.cgi, i don't know how to change the title to...

Top:non-english mod: non-english mod....
Quote Reply
Re: [leo2200] Download Mod question... In reply to
Have you tried copying the build_linked_title_mb from the code I posted elsewhere in place of the one in the download mod? Not sure if it'll work or not... Try it with the original name (...mb), then with the name Links uses; you just have to experiment some... Just remember to keep a backup of your working file!


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Download Mod question... In reply to
the code all of detail.cgi but i don't know how to edit and need edit other cgi....
Quote Reply
Re: [leo2200] Download Mod question... In reply to
An excellent, and free, editor is available from http://textpad.com .

Try adding this (modify the output code (html) to match your needs):

Code:
sub build_linked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with each part linked to the respective section. my ($input) = $_[0];
my ($description) = $_[1];
my (@dirs, $dir, $output, $path, $last, @descs, $desc);




@dirs = split (/\//, $input);
@descs = split (/\//, $description);
$last = pop (@dirs);
$last = pop (@descs);



$output = qq|<a class="smallnav" href="$build_root_url/top">Top</a> &#187;|;
foreach $dir (@dirs) {
$path .= "/$dir";
$desc = shift (@descs);



$output .= qq| <a class="smallnav" href="$build_root_url$path/">$desc</a> &#187;|;
}
$output .= " $last";



return $output;
}


In place of the 'sub build_linked_title' from the mod. Then add this

Code:


@categorylist = split (m:/:, $cat);
$depth_new = $#categorylist;
if ($depth_old >= $depth_new) {
for ($i = $depth_new; $i <= $depth_old; $i++) {
pop(@kategorylist);
}
}
$depth_old = $depth_new;
if ($nonenglish eq "") {
push(@kategorylist, $categorylist[$#categorylist]);
$title_linked = &build_linked_title ($cat);
$title = &build_unlinked_title ($cat);
$category_name = $cat;
$category_name_escaped = &urlencode ($cat);
$category_clean = &build_clean ($cat);
}
else {
push(@kategorylist, $nonenglish);
$nonenglishfull = join('/', @kategorylist);
$title_linked = &build_linked_title_mb ($cat, $nonenglishfull);
$title = &build_clean_mb ($cat, $nonenglishfull);


after this in the mod

sub main {
# --------------------------------------------------------

This is just a guess, I have not tried it!!!


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Download Mod question... In reply to
Thanks for help, but I got error 500..

sub main {
# --------------------------------------------------------
##########################################################
@categorylist = split (m:/:, $cat);
$depth_new = $#categorylist;
if ($depth_old >= $depth_new) {
for ($i = $depth_new; $i <= $depth_old; $i++) {
pop(@kategorylist);
}
}
$depth_old = $depth_new;
if ($nonenglish eq "") {
push(@kategorylist, $categorylist[$#categorylist]);
$title_linked = &build_linked_title ($cat);
$title = &build_unlinked_title ($cat);
$category_name = $cat;
$category_name_escaped = &urlencode ($cat);
$category_clean = &build_clean ($cat);
}
else {
push(@kategorylist, $nonenglish);
$nonenglishfull = join('/', @kategorylist);
$title_linked = &build_linked_title_mb ($cat, $nonenglishfull);
$title = &build_clean_mb ($cat, $nonenglishfull);
############################################################
%in = &parse_form();

my (%rec) = &get_record ($in{'ID'});

unless ($in{'ID'}) {
&html_print_headers;
print &site_html_detailed_error ("Kein Link angegeben."); #future versions will load a form instead of an error
}
elsif ($rec{$db_key} eq $in{'ID'}) {
$title_unlinked = &build_unlinked_title ("$rec{'Kategorie'}/$rec{'Titel'}");
$title_linked = &build_linked_title ("$rec{'Kategorie'}/$rec{'Titel'}");
$thiscat = $rec{'Kategorie'};
&html_print_headers;
print &site_html_detailed (%rec);
}
else {
&html_print_headers;
print &site_html_detailed_error ("Link $in{'ID'} nicht gefunden.");
}
}

###
# Can't require nph-build -- have to copy this stuff :-)
###

sub build_linked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with each part linked to the respective section.
#####################################################################
#½s¿è°Ï1
#######################################################################
# my $input = shift;
# my (@dirs, $dir, $output, $path, $last);
#
# @dirs = split (/\//, $input);
# $last = &build_clean(pop @dirs);
#
# $output = qq| <A HREF="$build_root_url/">­¶­º</A> :|;
# foreach $dir (@dirs) {
# $path .= "/$dir";
# $dir = &build_clean ($dir);
# $output .= qq| <A HREF="$build_root_url$path/">$dir</A> :|;
# }
# $output .= " $last";
#
# return $output;
#}
#########################################################
my ($input) = $_[0];
my ($description) = $_[1];
my (@dirs, $dir, $output, $path, $last, @descs, $desc);


@dirs = split (/\//, $input);
@descs = split (/\//, $description);
$last = pop (@dirs);
$last = pop (@descs);


$output = qq| <A HREF="$build_root_url/">­¶­º</A> :|;
foreach $dir (@dirs) {
$path .= "/$dir";
$desc = shift (@descs);
$output .= qq| <A HREF="$build_root_url$path/">$desc</A> :|;
}
$output .= " $last";
return $output;
}
##########################################################
sub build_unlinked_title {
# --------------------------------------------------------
Quote Reply
Re: [leo2200] Download Mod question... In reply to
What does your error log say?

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] Download Mod question... In reply to
this is the errorr log and errorr 500

Error Log ¿ù»~°T®§ Missing right curly or square bracket at /usr/home/uhomeu/Leohhh/cgi-bin/links20/detail.cgi line 179, at end of line
syntax error at /usr/home/uhomeu/Leohhh/cgi-bin/links20/detail.cgi line 179, at EOF
Execution of /usr/home/uhomeu/Leohhh/cgi-bin/links20/detail.cgi aborted due to compilation errors.
Quote Reply
Re: [leo2200] Download Mod question... In reply to
Can you attach detail.cg for us, so we can compare line numbers, and the errors?

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] Download Mod question... In reply to
how to send to you? i post all the detail.cgi ..

#!/usr/bin/perl
#!/usr/local/bin/perl
# File:
# info.cgi
# Date:
# July 6, 2000
# Author:
# Philip Putnam, based on code by Alex Krohn
# Description:
# Builds a dynamic details page in place of wasting valuable disk space.
# On the other hand, now ther're potential bandwidth problems :-)
# Comments:
# This script was written as a replacement for detail.cgi by Jerry Su.
# It consists mostly of code snippets from jump.cgi, modify.cgi, and
# nph-build.cgi. The last few pieces I figured out on my own. Unlike
# Jerry's version, mine loads up an error page instead of redirecting to
# the root url or a blank page.
# Support:
# Since I'm not a perl expert, I can't claim this script is flawless.
# Please post your questions or comments regarding this script to the
# Gossamer-Threads Links 2.0 Customization forum.
# =====================================================================
#
# Setup Notes:
# Make sure the require statement below points to the config file.

# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n[/url]";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}

# ========================================================

eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.

sub main {
# --------------------------------------------------------
%in = &parse_form();

my (%rec) = &get_record ($in{'ID'});

unless ($in{'ID'}) {
&html_print_headers;
print &site_html_detailed_error ("Kein Link angegeben."); #future versions will load a form instead of an error
}
elsif ($rec{$db_key} eq $in{'ID'}) {
$title_unlinked = &build_unlinked_title ("$rec{'Kategorie'}/$rec{'Titel'}");
$title_linked = &build_linked_title ("$rec{'Kategorie'}/$rec{'Titel'}");
$thiscat = $rec{'Kategorie'};
&html_print_headers;
print &site_html_detailed (%rec);
}
else {
&html_print_headers;
print &site_html_detailed_error ("Link $in{'ID'} nicht gefunden.");
}
}

###
# Can't require nph-build -- have to copy this stuff :-)
###

sub build_linked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with each part linked to the respective section.
#####################################################################
#½s¿è°Ï1
#######################################################################
my $input = shift;
my (@dirs, $dir, $output, $path, $last);

@dirs = split (/\//, $input);
$last = &build_clean(pop @dirs);

$output = qq| <A HREF="$build_root_url/">­¶­º</A> :|;
foreach $dir (@dirs) {
$path .= "/$dir";
$dir = &build_clean ($dir);
$output .= qq| <A HREF="$build_root_url$path/">$dir</A> :|;
}
$output .= " $last";

return $output;
}

sub build_unlinked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up by section.
# Useful for printing in the title.

my $input = shift;
my (@dirs, $dir, $output);

@dirs = split (/\//, $input);

$output = qq|$build_site_title : |;

foreach $dir (@dirs) {
$dir = &build_clean ($dir);
$output .= " $dir :";
}
chop ($output);
return $output;
}

###
# End of stuff we copied from nph-build.
###

sub error {
# ------------------------------------------
#
print "Content-type: text/html\n\n";
print "Error: $_[0]\n";
exit;
}
Quote Reply
Re: [leo2200] Download Mod question... In reply to
This line:

$output = qq| <A HREF="$build_root_url/">&shy;¶&shy;º</A> :|;

is like this in the stock form:

$output = qq| <A HREF="$build_root_url/">Top</A> :|;

That paragraph symbol is in a rather strange place...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Download Mod question... In reply to
Thanks for help

$output = qq| <A HREF="$build_root_url/">&shy;?amp;shy;?lt;/A> :|;

the ">&shy;?amp;shy;?lt is other language