Gossamer Forum
Home : Products : Links 2.0 : Customization :

nph-build not working with mods

Quote Reply
nph-build not working with mods
Hello all.

I am new to links 2.0 but slightly comfortable with per. I am trying to use links to set up a database for steam railroads and stuff. One of the things I wanted to do was have it build detailed pages which I can get it to do. But since my girlfriend speaks spanish, I thought I would have it also build detailed pages in spanish, reading the same database. Since I am using templates it seemed simple to do.

First I created a detailed-spanish template.

Next I located in links.cgf where paths are assigned and created new paths for the new details.

Then I located in site-html the build page routine and created a duplicate sub to build pages.
(sub site_html_detailed)

Next I found in nph-build a build page routine
sub build_detailed_view and created a copy of this with all the changes needed to point to the new templates and paths.

nph-build however would not execute.

I backed out everything and rechecked it by doing one step at a time. I finally got it down to ANY changes to nph-build.cgi is causing it not to run. I even took a new copy of the program, inserted a single line between the header and the first line of code (a blank line) re-ftp'ed it, chmod to execute and it still will not run.

I know the this program could not be so unstable that a single line change whould crash it (it is only used on like 1000s of sites) so it must be me. Can anyone tell me what I did/am doing wrong?

Will gladly post the mod information for all if I can get this to work.

Thanks
John
steambuff
Quote Reply
Re: [stearmbuff] nph-build not working with mods In reply to
So have you ever had it working, before you made your changes?

Also, do you have Telnet or SSH? If so, try running it from SSH:

perl nph-build.cgi

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!

Last edited by:

Andy: Jun 24, 2009, 9:51 AM
Quote Reply
Re: [Andy] nph-build not working with mods In reply to
Mr. A:

Yea it worked before mod.

And I upload a non modified nph-build (straight from unpack) and it will work.

No telnet and no SHH sorry.

Thanks
John
Quote Reply
Re: [stearmbuff] nph-build not working with mods In reply to
Try adding this after the path to perl:

Code:
use CGI::Carp qw(fatalsToBrowser);

This can sometimes give you details on why its giving an error.

Otherwise, do you have access to any error logs? If so, what do they 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] nph-build not working with mods In reply to
Mr. A.

Still no dice.

Have referred the matter to my host for them to check the logs.

It is just odd that a copy straight from the unpack works and doing any mod to it kills it. Even taking the mod back out it still does not work. Frown

Thanks for all;

John
Steambuff
Quote Reply
Re: [stearmbuff] nph-build not working with mods In reply to
You sure its uploading in ASCII?

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] nph-build not working with mods In reply to
Fixed.
My host reset the server (have no idea why this happened) but for some reason it now works.

Here is what I did, if someone wants to write it up a mod, they are welcome to it.

---------------------------------

Build second language detailed.html when using templates.
Please note, this does not create a second directory listing, but you could double link it from the category pages. If I get to it, I may create a category mod also.
########################################
create new template for second language, name it what ever you want, but you will have to use the name in the mod specifically.



########################################
In site_html_templates

#following sub for spanish build
sub site_html_detailed_sp {
# --------------------------------------------------------
# This routine will build a single page per link. It's only
# really useful if you have a long review for each link --
# or more information then can be displayed in a summary.
#


# the next line has the name of the template that you created for the new detailed. I named
#it detailed_sp.html, but you can name it anything as long you match here and in templates.
my %rec = @_;
return &load_template ('detailed_sp.html', {
total => $total,
grand_total => $grand_total,
title_linked => $title_linked,
%rec,
%globals
} );
}

# end spanish build


########################################
In links.cfg

#next two lines part of Spanish build
#insert near section that assigns other paths
$build_detail_path_sp = "$build_root_path/Spanish";
$build_detail_url_sp = "$build_root_url/Spanish";


########################################

In nph_build
#Insert this code TWICE one in build_staggered and once in build_all
print "Generating Spanish detailed view pages . . . \n";
&build_detailed_view_spanish;
print "Done with Spanish\n\n";


Place the following sub immediately after the sub build_detailed_view in nph-build.cgi

### following sub for Spanish build
sub build_detailed_view_spanish {
# --------------------------------------------------------
# This routine build a single page for every link in spanish
#
my (@values, $id, %rec, $count);
if ($build_detail_path_sp =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}
print "\t";
open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name. Reason: $!");
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$id = $values[$db_key_pos];
%rec = &array_to_hash (0, @values);
$title_linked = &build_linked_title ("$rec{'Category'}/$rec{'Title'}");
open (DETAIL, ">$build_detail_path_sp/$id$build_extension") or &cgierr ("Unable to build detail page: $build_detail_path/$id$build_extension. Reason: $!");
print DETAIL &site_html_detailed_sp (%rec);
close DETAIL;
$use_html ?
print qq~<a href="$build_detail_url_sp/$id$build_extension" target="_blank">$id</a> ~ :
print qq~$id ~;
(++$count % 10) or print "\n\t";
}
close DB;
print "\n";
}
### End Spanish Sub


########################################

End of mods for dual language.

Enjoy one and all and thank you for your help

Steambuff
Post deleted by PerlFlunkie In reply to