Gossamer Forum
Home : Products : Links 2.0 : Customization :

Customizing sub-category layout - ERROR!

Quote Reply
Customizing sub-category layout - ERROR!
I tried to get rid of the spaces in between the sub-categories by taking out the <dl></dl> in the site_html_templates.html file under the sub site_html_print_cat section as suggested here in the forum. Changing this: CATEGORY CATEGORY To This: CATEGORY CATEGORY Now, when I try to "Build All" in the Links admin, a pop-up screen asks me if I want to download the nph-build.cgi file and gives me the following error: Error including libraries: syntax error at /home/eblade/ebladestore-www/cgi-bin/links/admin/site_html_templates.pl line 31, near "g"
Compilation failed in require at nph-build.cgi line 33.

Make sure they exist, permissions are set properly, and paths are set correctly. They seem to be set correctly. Here's my file.....

# -------------

# Links

# -------------

# Links Manager

#

# File: site_html.pl

# Description: This library contains all the HTML that will be generated in

# the finished directory.

# Author: Alex Krohn

# Email: alex@gossamer-threads.com

# Web: http://www.gossamer-threads.com/

# Version: 2.0

#

# (c) 1998 Gossamer Threads Inc.

#

# This script is not freeware! Please read the README for full details

# on registration and terms of use.

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

# ----------------------------------------------------------------------

# The HTML in this file and the style sheet (links.css) have been authored

# by Chris Croome of webarchitects.

#

# Email: chris@atomism.demon.co.uk

# Web: http://www.webarchitects.co.uk/

# ----------------------------------------------------------------------

# You can put variables here that you would like to use in any

# of your templates.

%globals = (

Date => &get_date,

time => &get_time,

db_cgi_url => $db_cgi_url,

build_root_url => $build_root_url,

site_title => $build_site_title,

css => $build_css_url,

banner => ''

);



sub site_html_link {

# --------------------------------------------------------

# This routine is used to display what a link should look

# like.

my %rec = @_;

# Set new and pop to either 1 or 0 for templates.

($rec{'isNew'} eq 'Yes') ? ($rec{'isNew'} = 1) : (delete $rec{'isNew'});

($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});

return &load_template ('link.shtml', {

detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",

%rec,

%globals

});

}

sub site_html_home {

# --------------------------------------------------------

# This routine will build a home page. It is not meant to have any

# links on it, only subcategories.

return &load_template ('home.shtml', {

category => $category,

grand_total => $grand_total,

%globals

});

}

sub site_html_new {

# --------------------------------------------------------

# This routine will build a what's new page.

return &load_template ('new.shtml', {

total => $total,

grand_total => $grand_total,

link_results => $link_results,

title_linked => $title_linked,

%globals

} );

}

sub site_html_cool {

# --------------------------------------------------------

# This routine will build a what's new page.

return &load_template ('cool.shtml', {

total => $total,

grand_total => $grand_total,

percent => $percent,

link_results => $link_results,

title_linked => $title_linked,

%globals

} );

}

sub site_html_detailed {

# --------------------------------------------------------

# 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.

#

my %rec = @_;

return &load_template ('detailed.shtml', {

total => $total,

grand_total => $grand_total,

title_linked => $title_linked,

%rec,

%globals

} );

}

sub site_html_category {

# --------------------------------------------------------

# This rountine will build a page based for the current category.

return &load_template ( 'category.shtml', {

date => $date,

time => $time,

category => $category,

links => $links,

title_linked => $title_linked,

title => $title,

total => $total,

grand_total => $grand_total,

category_name => $category_name,

category_name_escaped => $category_name_escaped,

category_clean => $category_clean,

description => $description,

meta_name => $meta_name,

meta_keywords => $meta_keywords,

header => $header,

footer => $footer,

prev => $prev,

next => $next,

related => $related,

build_links_per_page => $build_links_per_page,

%globals

} );

}

sub site_html_ratings {

# --------------------------------------------------------

# This routine determines how the top rated page will look like.

return &load_template ( 'rate_top.shtml', {

top_rated => $top_rated,

top_votes => $top_votes,

%globals

});

}

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

# THE FOLLOWING ARE CGI GENERATED PAGES AND THE TEMPLATE MUST BE PRINTED, NOT RETURNED!#

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

sub site_html_add_form {

# --------------------------------------------------------

# This routine determines how the add form page will look like.

#

&html_print_headers;

my $category = shift;

$category ?

($category = qq~$category <input type=hidden name="Category" value="$category">~) :

($category = &build_select_field ("Category", "$in{'Category'}"));



print &load_template ('add.shtml', {

Category => $category,

%globals

});

}

sub site_html_add_success {

# --------------------------------------------------------

# This routine determines how the add success page will look like.

&html_print_headers;

print &load_template ('add_success.shtml', {

%in,

%globals

});

}

sub site_html_add_failure {

# --------------------------------------------------------

# This routine determines how the add failure page will look like.

my ($errormsg) = shift;

$in{'Category'} ?

($in{'Category'} = qq~<input type=hidden name="Category" value="$in{'Category'}">$in{'Category'}~) :

($in{'Category'} = &build_select_field ("Category"));



&html_print_headers;

print &load_template ('add_error.shtml', {

error => $errormsg,

%in,

%globals

});

}

sub site_html_modify_form {

# --------------------------------------------------------

# This routine determines how the modify form page will look like.

my $category = &build_select_field ("Category", "$in{'Category'}");

&html_print_headers;

print &load_template ('modify.shtml', {

Category => $category,

%globals

});

}

sub site_html_modify_success {

# --------------------------------------------------------

# This routine determines how the modify success page will look like.

&html_print_headers;

print &load_template ('modify_success.shtml', {

%in,

%globals

});

}

sub site_html_modify_failure {

# --------------------------------------------------------

# This routine determines how the modify failure page will look like.

my $errormsg = shift;

$in{'Category'} = &build_select_field ("Category", $in{'Category'});

&html_print_headers;

print &load_template ('modify_error.shtml', {

error => $errormsg,

%in,

%globals

});

}

sub site_html_search_results {

# --------------------------------------------------------

# This routine displays the search results.

#

my $term = &urlencode ($in{'query'});

&html_print_headers;

print &load_template ('search_results.shtml', {

term => $term,

link_results => $link_results,

category_results => $category_results,

next => $next,

cat_hits => $cat_hits,

link_hits => $link_hits,

%in,

%globals

});

}

sub site_html_search_failure {

# --------------------------------------------------------

# This routine displays a failed search page with error in $error.

#

my $error = shift;

my $term = &urlencode ($in{'query'});

&html_print_headers;

print &load_template ('search_error.shtml', {

term => $term,

error => $error,

%in,

%globals

});

}

sub site_html_search_form {

# --------------------------------------------------------

# This routine displays the search form.

&html_print_headers;

print &load_template ('search.shtml', {

term => $term,

error => $error,

%in,

%globals

});

}

sub site_html_mailing {

# --------------------------------------------------------

# This routine displays your mailing list subscribe/unsubscribe form.

#

my $action = shift;

my $message;

($action eq 'subscribe') and ($message = qq~You've been successfully subscribed to the mailing list!~);

($action eq 'unsubscribe') and ($message = qq~You've been successfully removed from the mailing list!~);

&html_print_headers;

print &load_template ('email.shtml', {

message => $message,

%in,

%globals

});

}

sub site_html_mailing_error {

# --------------------------------------------------------

# This routine is displayed if there was a problem subscribing.

#

my $error = shift;

&html_print_headers();

print &load_template ('email_error.shtml', {

error => $error,

%in,

%globals

});

}

sub site_html_rate_form {

# --------------------------------------------------------

# This routine determines how the rate form page will look like.

#

my %rec = @_;



&html_print_headers;

print &load_template ('rate.shtml', {

%rec,

%globals

});

}

sub site_html_rate_success {

# --------------------------------------------------------

# This routine determines how the rate success page will look like.

&html_print_headers;

print &load_template ('rate_success.shtml', {

%in,

%globals

});

}

sub site_html_rate_failure {

# --------------------------------------------------------

# This routine determines how the rate failure page will look like.

my ($errormsg) = shift;

&html_print_headers;

print &load_template ('rate_error.shtml', {

error => $errormsg,

%in,

%globals

});

}

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

# THE FOLLOWING DETERMINES YOUR CATEGORY LISTING, IT'S NOT TEMPLATE BASED (YET)! #

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

sub site_html_print_cat {

# --------------------------------------------------------

# This routine determines how the list of categories will look.

# We now use a table to split the category name up into two columns.

# For each category you can use the following variables:

#

# $url : The URL to go to that category

# $category_name : The category name with _ and / removed.

# $category_descriptions{$subcat}: The category description (if any).

# $numlinks : The number of links inside that category (and subcategories).

# $mod : The newest link inside of that category.

#

my (@subcat) = @_;

my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);

my ($half) = int (($#subcat+2) / 2);



# Print Header.

$output = qq|<div class="margin"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;



foreach $subcat (sort @subcat) {

($description) = @{$category{$subcat}}[2];



# First let's get the name, number of links, and last modified date...

$url = "$build_root_url/" . &urlencode($subcat) . "/";

if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }

$numlinks = $stats{"$subcat"}[0];

$mod = $stats{"$subcat"}[1];

# We check to see if we are half way through, if so we stop this table cell

# and begin a new one (this lets us have category names in two columns).

if ($i == $half) {

$output .= qq|</td><td class="catlist" valign="top">\n|;

}

$i++;



# Then we print out the name linked, new if it's new, and popular if its popular.

$output .= qq|<dl><dt><strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;

$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);

$output .= qq|</dt>|;

$output .= qq|<dd><span class="descript">$description </span></dd>| if (!($description =~ /^[\s\n]*$/));

$output .= qq|</dl>|;

}

# Don't forget to end the unordered list..

$output .= "</td></tr></table></div>\n";

return $output;

}

1;

Jason

www.eBladeStore.com/links/pages
Quote Reply
Re: [trodat] Customizing sub-category layout - ERROR! In reply to
Does the code you posted have the changes you made? I did not see them... You only need to post the part you're working with, not the whole file. Also, if you make the part you changed a different color, it will help us help you. Wink


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Customizing sub-category layout - ERROR! In reply to
I kept a copy of the original file so that's what I posted. I'm thinking it's a permission error or something possibly got corrupt in my process. I've been checking permissions and paths.. everthing seems to be checking out so far... I've also noticed that anytime I try and access a .pl or .cgi file like search or modify pages, I get the popup download page asking me to download the script that i'm trying to access. I hope this helps.

Sorry about the post... I'm new to posting :(

Jason
Quote Reply
Re: [trodat] Customizing sub-category layout - ERROR! In reply to
The error you posted points to this in nph-build:

$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";

This is an option set in links.cfg, here:

# Use Templates: instead of editing site_html.pl, you can edit regular html pages
# encoded with special <%links_tags%>. It's not as flexible as site_html.pl, but it
# may be easier.
$build_use_templates = 1;

Set to 1 = uses templates and site_html_templates.pl, set to 0 = no templates, use site_html.pl.

If that is set how you want, make sure that the paths are correct:

so, $db_lib_path = $db_script_path; # PATH of library files.

# PATH and URL of Admin CGI directory. No Trailing Slash.
$db_script_path = "/alex/links/cgi-bin/admin";
$db_dir_url = "http://localhost/links/cgi-bin/admin";

the red part is your FULL PATH to the admin directory.


Leonard
aka PerlFlunkie
Quote Reply
Re: [trodat] Customizing sub-category layout - ERROR! In reply to
did you upload the file in ASCII or BINARY? The extra lines there seem to indicate binary. upoad the links files as ascii.

If that does not work, try uploading the original and see if that runs.

Looks like it is pointing to this line

Code:
%globals = (


which is the first line after the intro area of the file


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."

Last edited by:

esm: Feb 3, 2003, 1:23 AM