Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Add a New Template / Static Page

Quote Reply
Add a New Template / Static Page
There used to be a simple -kind of - way to Add a New Template / Static Page like terms, agreement ... ext in links sql version 1.
Anyone knows how to do that in Links SQl 2.03?
I think it should be way easier just need some guidence.

Thanks
AARON

Quote Reply
Re: Add a New Template / Static Page In reply to
1) Add the sub in your SiteHTML.pm module.
2) Then copy the sub build_new_page routine in the nph-build.cgi script. Take out all the extraneous codes...
3) Then create a new template file.

Regards,

Eliot Lee
Quote Reply
Re: Add a New Template / Static Page In reply to
Unless you need special processing, such as link.html (to do the yes/no, dates, etc) or category, where you have to do translations on the ID's, you can just pass the template name to the display routine. You don't need to edit the Site_HTML.pm file at all!

print $IN->header();
print Links::SiteHTML::display ('template', $hash_reference);

If it just uses the standard links variables, and template globals, you don't even need a full routine. You can just add something like:

sub _build_added_page {
# ------------------------------------------------------------------
# Generate the added page.
#
_time_start();

my $page = $CFG->{build_root_path} . "/" . 'added.page.html';
$USE_HTML ?
print "Building <a href='$CFG->{build_root_url}/added.page.html' target='_blank'>Added Page</a> ... \n" :
print "Building Added Page ... \n";

open (ADDED, "> $page") or _cant_open($page, $!);
print ADDED Links::SiteHTML::display ('added_page', $hash_reference);
close ADDED;
my $perms = oct ($CFG->{build_file_per});
chmod ($perms, $page);

print "Done (", _time_display(), " s)\n\n";
}

To the nph-build.cgi file, with a call to it:

&_build_added_page();

in the build_staggered and build_all routines.

You don't need to use the plugin format, since nothing is going to try to hook into the call to this routine, and it uses the 'display' hook, so anything done to displayed templates will be done to it.

Rather than do this, you can use page.cgi to do this, by passing in the template you wish to display by the p= parameters.

If you have a template page "information.html" you would call it:

../page.cgi?p=information

The only parameter used by page.cgi is the p= and once passed to the display routine, the t= (template set) is also examined.

So, it's a lot simpler than trying to edit the code and create static pages <G>

PUGDOG« Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Add a New Template / Static Page In reply to
I took pugdog's _build_added_page routine and inserted code and references where indicated in the example. When I run Build All, I get:

Global symbol "$USE_HTML" requires explicit package name at c:/websites/sweepstalk/links/admin/Links/SiteHTML.pm line 217.

Since my current status is perl nubie, I commented out the $USE_HTML line (not to solve the problem but to experiment) and got:

Global symbol "$hash_reference" requires explicit package name at c:/websites/sweepstalk/links/admin/Links/SiteHTML.pm line 221.

This may be the result of my commenting out $USE_HTML, but ..

My code is:

sub _build_psa_pages {
# ------------------------------------------------------------------
# Generate the PSA added page. %%% PSA added 8/10/01
#
_time_start();

my $pagename = 'feedback.html';
my $page = $CFG->{build_root_path} . "/" . $pagename;
$USE_HTML ?
print "Building <a href='$CFG->{build_root_url}/$pagename' target='_blank'>Added $page</a>\n" ;

open (ADDED, "> $page") or _cant_open($page, $!);
print ADDED Links::SiteHTML::display ('feedback.html', $hash_reference);
close ADDED;
my $perms = oct ($CFG->{build_file_per});
chmod ($perms, $page);

print "Done (", _time_display(), " s)\n\n";
}

Thanks in advance for any help.

Quote Reply
Re: [halm] Add a New Template / Static Page In reply to
try this one.

sub _build_psa_pages {
# ------------------------------------------------------------------
# Generate the PSA added page. %%% PSA added 8/10/01
#
_time_start();

my $pagename = 'feedback.html';
my $page = $CFG->{build_root_path} . "/" . $pagename;
$USE_HTML ?
print "Building <a href='$CFG->{build_root_url}/$pagename' target='_blank'>Added $page</a>\n" ;

open (ADDED, "> $page") or _cant_open($page, $!);
print ADDED Links::SiteHTML::display ('feedback', { });
close ADDED;
my $perms = oct ($CFG->{build_file_per});
chmod ($perms, $page);

print "Done (", _time_display(), " s)\n\n";
}
Quote Reply
Re: [courierb] Add a New Template / Static Page In reply to
Hi!

Can somebody tell me which the code is to insert in siteHTML.pm?

I works with LSQL212

This code http://www.gossamer-threads.com/...i?post=112988#112988 doesn't work:

Code:


sub site_html_terms_and_agreements {
# --------------------------------------------------------
# This routine will build a what's new page.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('terms.html', {
%$tags,
%GLOBALS
}, undef, $template );
defined $dynamic and &clean_output($dynamic, \$output);
return $output;
}


Thank you in advance!![/url]

-----------------------
Nomada
Quote Reply
Re: [Nomada] Add a New Template / Static Page In reply to
Have you considered yogi's PageBuilder Plugin? It makes what you are trying to do, so much easier Smile

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] Add a New Template / Static Page In reply to
Andy;,
Not really. Yogi's plugin is great, but needs learning, and enough clear examples are not given.
Adding in these routines gives you the webmaster what is needed in this case, and there is greater flexibility in the file name.

Yogi's plugin is due for a new version, too...
Quote Reply
Re: [webslicer] Add a New Template / Static Page In reply to
I would use yogi's plugin any day, over writing hacks into LSQL (simply due to upgradability).

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] Add a New Template / Static Page In reply to
Andy,

There is a time and place for plugins <G>

If you are methodical about what routines you add to what files -- such as Build -- then in many cases it's all you need.

One of my sites has so many plugins loaded, if I had to debug it, I'd go nuts!

I've converted many of the basics to *.pm's that are just included into other files. In an upgraded, all I have to do is include the include lines, and I'm good to go.

This works for routines that do not need "hooks" and it can simplify things greatly!

One of the things I'm working on is a plugin for plugins, and it allows you to add files like this, but it manages the hooks. I'm not terribly far along, but it's a dispatcher for the plugins, and sort of came about from trying to write the arbitrary tables program. It's goal is to allow me to take all the modifications I like to make to a site, and just copy them over en masse to a new site, without having to deal with loads of tidbits and trivia. Not quite a "links extended" type idea, but similar in effect.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Add a New Template / Static Page In reply to
>>>One of the things I'm working on is a plugin for plugins,<<<


Sounds good :)

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!