Gossamer Forum
Home : Products : Links 2.0 : Customization :

YOUR OPINION?

Quote Reply
YOUR OPINION?
hELLO,
i use template.cfg and a sort of variables in my globals to display the content of each one in my pages.
But if i put <%variable%> in any other page of mine than the basics (like search_results.html, category.html....) i get no content.

Can anyone answer this?Unsure
Loucian
Quote Reply
Re: [loucian] YOUR OPINION? In reply to
If it were me I'd create a hash like.......
Code:
my %layout = (

FONT => '<font color="#000000">',
END_FONT => '</font>'

);

Then add %layout to the subs in site_html_templates.pl so you can use any of the tags in any pages

....just keep adding new keys to the hash.


Last edited by:

PaulWilson: Sep 16, 2001, 4:54 AM
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
Can you pls be more specific?
I create this code where ? In my site_html_template.pl ?

my %layout = (

FONT => 'content',
END_FONT => '</font>'

);

And what should i enter in my pages to display the content??
Quote Reply
Re: [loucian] YOUR OPINION? In reply to
Thinking about it............you don't need to do all that......just add the new keys to the globals.......

Code:
%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,
font => 'content',
end_font => '</font>'
);

.....then you can use those tags in any pages.....like <%font%>

Last edited by:

PaulWilson: Sep 16, 2001, 5:05 AM
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
ok i ma coming back with this:
%globals = (
date => &get_date,
time => &get_time,
db_cgi_url => $db_cgi_url,
build_root_url => $build_root_url,
site_title => $build_site_title,
left_help => $left_help,
);

my %layout = (

left_help => '<table cellpadding=2 cellspacing=0 border=0 width="100%">
<tr bgcolor="#FFE566"><td align=center>
<font face="arial,helvetica"><b>Top 5 Questions</b></font>
</td></tr>
<tr><td align=center>
<table border=0 cellpadding=2 cellspacing=2>
<tr>
<td>
<small><B>1.</b><a href="templates/register.html">Do I need to register to use Poynting!?</a>
<BR><B>2.</b><a href="templates/about.html">What is Poynting!?</a>
<BR><B>3.</b><a href="templates/startpagehelp.html">How to make Poynting! your home page!?</a>
<BR><b>4.</b><A HREF="templates/banners.html">Why banners Pop up exist?</A>
<BR><B>5.</b><a href="templates/permission.html">Do I need permission to link to Poynting!?</a>

</small>
</td>
</tr>
</table><br>
</td></tr>
</table>

<table width="100%" cellpadding=0 cellspacing=0 border=0>
<tr><td>

<!-- _POLL_MODULE_ -->
<center>

<table width="100%" cellpadding=2 cellspacing=0 border=0>
<tr bgcolor="#FFE566">
<td align=center colspan=2 valign=top><font face="arial"><b>Related Links</b></font>
</td>
</tr>
<tr bgcolor="#EEEEEE">
<td colspan=2>
<small>
<li><a href="templates/first.html">First time visitor?</a>
<li><a href="templates/terms.html">Terms of use</a>
<li><a href="templates/press.html">Press Release</a>
<li><a href="templates/contact.html">How to contact us</a>
</small><P>
</font></td>
</tr>
</table>
</center>
</td></tr>
</table>',
);

Is it right????? because It doesn't work
...

Quote Reply
Re: [loucian] YOUR OPINION? In reply to
No,

If you have a big chunk of html use......
Code:
sub html {

my $output = qq| HTML CODE HERE |;
return $output;

}

Then in the globals add:

html => &html

......and put <%html%> in the templates.
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
Hi again Paul,

It doesn't work again .Here is my code to review:


# 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,
left_help => $left_help
);

sub left_help {

my $output = qq| <table cellpadding=2 cellspacing=0 border=0 width="100%">
<tr bgcolor="#FFE566"><td align=center>
<font face="arial,helvetica"><b>Top 5 Questions</b></font>
</td></tr>
<tr><td align=center>
<table border=0 cellpadding=2 cellspacing=2>
<tr>
<td>
<small><B>1.</b><a href="templates/register.html">Do I need to register to use Poynting!?</a>
<BR><B>2.</b><a href="templates/about.html">What is Poynting!?</a>
<BR><B>3.</b><a href="templates/startpagehelp.html">How to make Poynting! your home page!?</a>
<BR><b>4.</b><A HREF="templates/banners.html">Why banners Pop up exist?</A>
<BR><B>5.</b><a href="templates/permission.html">Do I need permission to link to Poynting!?</a>

</small>
</td>
</tr>
</table><br>
</td></tr>
</table>

<table width="100%" cellpadding=0 cellspacing=0 border=0>
<tr><td>

<!-- _POLL_MODULE_ -->
<center>

<table width="100%" cellpadding=2 cellspacing=0 border=0>
<tr bgcolor="#FFE566">
<td align=center colspan=2 valign=top><font face="arial"><b>Related Links</b></font>
</td>
</tr>
<tr bgcolor="#EEEEEE">
<td colspan=2>
<small>
<li><a href="templates/first.html">First time visitor?</a>
<li><a href="templates/terms.html">Terms of use</a>
<li><a href="templates/press.html">Press Release</a>
<li><a href="templates/contact.html">How to contact us</a>
</small><P>
</font></td>
</tr>
</table>
</center>
</td></tr>
</table>|;
return $output;

}

Quote Reply
Re: [loucian] YOUR OPINION? In reply to
It's &left_help not $left_help
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
Thank you & Sorry but it doesn't work again...and i have too many pages that i need to do it like this.Isn't any other way.I have to do it work.I need it.
Here is the code i enter:

%globals = (
date => &get_date,
time => &get_time,
db_cgi_url => $db_cgi_url,
build_root_url => $build_root_url,
site_title => $build_site_title,
left_help => &left_help
);

Can HELP ME PLS..it doesn't work...

Last edited by:

loucian: Sep 16, 2001, 5:57 AM
Quote Reply
Re: [loucian] YOUR OPINION? In reply to
It does work.

I assume you rebuilt ?
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
Yes i did a rebuild. I don't know what to assume.
Do you have any idea????


Quote Reply
Re: [loucian] YOUR OPINION? In reply to
So do you have <%left_help%> in the template and is %globals in that particular template sub in site_html_templates.pl ?

Do you get errors? Please be specific.
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
Yes i do have all these you have mentioned.

Please note this:
The code as i see now is appearing in my search results page fine (if i enter <%left_help%> in search_results.html) but it does not appearing in the page that i want it to appear which is the page : starting.html. In this page i want to appear the code.

I can give you my codes to ftp my site if that will be needed.

Quote Reply
Re: [loucian] YOUR OPINION? In reply to
I need to see the code that is loading starting.html from site_html_templates.pl
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
Hi again,
I have send you feedback regarding mt codes to ftp.
Note that the starting.html is located in my templates directory:http://satellitehit.virtualave.net/cgi-bin/links2/links/cgi-bin/admin/templates/starting.html

Regards
Loucian
Quote Reply
Re: [loucian] YOUR OPINION? In reply to
errr ...that link doesn't help and I don't think that's exactly want Paul meant....

either attach it to your next post here or at least put the file in a readable directory and change the .html to .txt
that way somebody will be able to read the code.

good luck


openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] YOUR OPINION? In reply to
Hey if that what Paul needs i ll do that but i have sent the codes to ftp the site by email.
Read carefully the last 2 posts.
Quote Reply
Re: [loucian] YOUR OPINION? In reply to
Hi,

I just need to see the code in site_html_templates.pl that loads starting.html

It should look something like:

Code:
sub site_html_starting {
# --------------------------------------------------------
#

&html_print_headers;
print &load_template ('starting.html', {
%in,
%globals
});
}

(I assume).......
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
Here is my file.What you told me to change, i have changed.Check it for errors.
# -------------
# 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.01
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================

# 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,
left_help => &left_help
);

sub left_help {

my $output = qq| HTML CODE HERE |;
return $output;

}




sub site_html_link {
my $template_link;
# Set the appropriate template file to load
if ($category_results =~ "$category_name") {
$template_link = "link.html"; }
#all other categories use standard link template
else { $template_link = "linkcat.html"; }

# --------------------------------------------------------
# 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'});

$cat_clean = &build_clean($rec{Category});

return &load_template ( $template_link, {
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
%rec,
%globals,
cat => $cat_clean
});

}


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.html', {
category => $category,
grand_total => $grand_total,
%globals
});
}

sub site_html_new {
# --------------------------------------------------------
# This routine will build a what's new page.

return &load_template ('new.html', {
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.html', {
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.html', {
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.html', {
date => $date,
time => $time,
term => $term,
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.html', {
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.html', {
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.html', {
%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.html', {
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.html', {
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.html', {
%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.html', {
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.html', {
term => $term,
csearch_results => $csearch_results,
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.html', {
term => $term,
error => $error,
%in,
%globals
});
}

sub site_html_search_form {
# --------------------------------------------------------
# This routine displays the search form.

&html_print_headers;
print &load_template ('search.html', {
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.html', {
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.html', {
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.html', {
%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.html', {
%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.html', {
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|<li><strong><a class="link" href="$url">$category_name</a></strong> <FONT class="link"><I>($numlinks)</I></FONT> |;
$output .= qq|<img src="http://satellitehit.virtualave.net/cgi-bin/links2/links/pages/new.gif">| if (&days_old($mod) < $db_new_cutoff);
$output .= qq||;
$output .= qq|<span class="descript">$description </span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</li>|;
}

# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
}

1;
Quote Reply
Re: [loucian] YOUR OPINION? In reply to
Next time, please save requested files/subs in a text file and then put it in your web server, then provide a LINK to the .txt file in the forum threads.

Posting the file in Threads is difficult to read and also waste of GT's disk space.

Thank you.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [AnthroRules] YOUR OPINION? In reply to
Yes sure...Eliot.
That was stupid.
Next time i ll do that.
Thank you
Quote Reply
Re: [loucian] YOUR OPINION? In reply to
I dont see where starting.html is loaded.
Quote Reply
Re: [PaulWilson] YOUR OPINION? In reply to
Should i enter the code to load starting.html as you posted below? If so where to copy and paste the code?
Quote Reply
Re: [loucian] YOUR OPINION? In reply to
What does starting.html do at the moment?
How is it used?
Where is it used?
Where is is called from?

Quote Reply
Re: [loucian] YOUR OPINION? In reply to
Ok here is the new code i have enter but it doesn't work again:

http://satellitehit.virtualave.net/cgi-bin/links2/links/cgi-bin/admin/site_html_templates.txt


The starting.html is located in my templates directory:

http://satellitehit.virtualave.net/cgi-bin/links2/links/cgi-bin/admin/templates/starting.html

Last edited by:

loucian: Sep 16, 2001, 9:14 AM