Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Printer Friendly version?

Quote Reply
Printer Friendly version?
I would like to create a template set that is a printer friendly version of an article (link) and I am just looking for what I would use to call the page. So, it would only be for the detailed page. What would I use to call the DB for that page alone. In other words, I don't want folks being able to surf our entire site dynamically (server load issues). Is trhere a way to have a static printer friendly version display?

How would I do this?
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
Sure...build a copy of all your detailed pages.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
Don't the copies just replace the originals? I can imagine changing the setup paths, but this is a bit much for my staff of non-techie editors to do and reset when they are done. Too many steps. I'd rather hav it set up in the templates or a global or something, so that it just works right.

Other ideas?
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
Uh...NOT if you use a separate detailed build subtroutine in the nph-build.cgi script!!!!!!!!!!!!! Tongue

Uh, if you copy the detailed sub, name it something else, then edit the variables in that sub to a "copy" name of the detailed pages, then you would have the following type of files in your "Detailed" folder:

1.shtml
print1.shtml
2.shtml
print2.shtml

Got it? Good!
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
You could do that in a plugin.

1) Create a PRE hook on 'create_detailed' and let it run your function 'build_pf_detailed'.
2) Then you would basically just copy the sub '_build_detailed' into your function 'build_pf_detailed'. You would have to change the name of the output files (into something like '423_pf.html' (where 423 is an example link ID). And you would have to change the name of the template file to use.
3) make a new template file for the printer-friendly detailed pages.
4) link to the files in the appropriate places.
5) build your directory.

Voila. It's really not that difficult.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
Hey Yogi,

Thank. I don't know how to create a PRE hook. Is there some documentation somewhere that would explain this? Or can you explain this? Thanks again.

Last edited by:

Evoir: Apr 5, 2002, 1:56 PM
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
Hi,

I have attached a plugin that should do the job. I've kept it very simple. What you have to do is the following:

1) Install plugin (called SecondDetailed, see attachement)
2) create a template called "detailed2.html" (this is the printer-friendly template)
3) build your directory. The usual detailed pages are under /Detailed/1243.html, the printerfriendly ones will be under /Detailed/1234-2.html

Hope it works. I thought that this would be a quick thingy, but ended up coding for an hour before it was actually working....

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
Have you considered doing this with CSS? This is our solution for printers ... though it does not work on old browsers, so is not a universal solution. Try it if you don't require printer-friendliness for every single visitor ...

On each page, link to two stylesheets, eg:
Code:
<LINK REL="stylesheet" HREF="/print.css" TYPE="text/css" MEDIA="print" TITLE="Print">
<LINK REL="stylesheet" HREF="/screen.css" TYPE="text/css" MEDIA="screen" TITLE="Screen">

File screen.css contains the normal styles; print.css contains only simplified styles with no positioning, font families, font sizes, etc.

Menu systems and other page clutter can be hidden from the printer like this ...
Code:
.barmenu, .search, .footnotes, .breadcrumb {
display: none;
}
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
Wow yogi, you rock! I'm gonna get to this in the next few days. Thank you very much. I hope others will benefit from the work you put into it. Smile
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
Yogi,

I installed the plugin, and created a second detailed template called detailed2.html

When I went to build all" I get the following error:
Code:
A fatal error has occured:


Can't locate object method "get_plugin_user_cfg" via package "Links::Plugins" at /big/dom/xcurvemag/cgi-bin/LSQL/cgi/admin/Plugins/SecondDetailed.pm line 31.

Please enable debugging in setup for more details.

Ideas? Solution?

Thank you!
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
What version of Links SQL are you using?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
LSQL 2.10
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
Can you enable debugging and post the details?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
yogi,

I enabled debugging, turned your plugin back on, and tried re-building. Basically, it is stuck... calling the webpage. I guess it would be called a time-out. Ok, the page finally loaded, but it doesn't show the whole build process. It just stops:
Code:
Started at Wed Apr 10 05:01:34 2002.

Creating backup file ...
Done (0.00 s)

Resetting hits and rates ...
Done (0.00 s)

Updating New Flags ...
Done (1.00 s)

Updating Changed Flags ...
Done (0.00 s)

Updating Cool Flags ...
Done (0.00 s)

Building Home Page ...
Done (0.00 s)

Building What's New Index ...
Building Subpage: 2002-03-27 ... 7 links ok.
Building Subpage: 2002-03-28 ...
and doesn't go any further. This is with debugging set to 1


p.s. Yogi, I think you have a really nice LSQL site. Is the consistant left navigation bar a LSQL SSI type thing? Or is that dynamically generated?
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
In Reply To:
I enabled debugging, turned your plugin back on, and tried re-building. Basically, it is stuck... calling the webpage. I guess it would be called a time-out. Ok, the page finally loaded, but it doesn't show the whole build process. It just stops:

Strange. I don't see why it wouldn't work... Is there no error message?

In Reply To:
p.s. Yogi, I think you have a really nice LSQL site. Is the consistant left navigation bar a LSQL SSI type thing? Or is that dynamically generated?

Thanks. At the moment, I am still using Links 2, I am in the process of migrating to LSQL. As far as I know, I only have a left navigation bar on the homepage, not on any other page.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
You need to make sure you have:

use Links::Plugins;

....at the top to be able to use get_plugin_user_cfg

Or change:


my $sdv = Links::Plugins->get_plugin_user_cfg('SecondDetailed');

to

require Links::Plugins;
my $sdv = Links::Plugins->get_plugin_user_cfg('SecondDetailed');

Last edited by:

Paul: Apr 10, 2002, 2:30 AM
Quote Reply
Re: [Paul] Printer Friendly version? In reply to
Yes, that is probably it! I have it locally, but probably forget to put it in the file.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [Paul] Printer Friendly version? In reply to
Paul,

I know this sounds lazy or dumb... but can you explain to so a dummy can just follow your directions really simply. (like: find this. replace this. or, between this and this put this line)

I vaguely know what you are talking about, but I can follow directions pretty well. Smile
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
1) Uninstall the plugin
2) click on edit
3) click on edit (SecondDetailed.pm)
4) add the line use Links::Plugins; just under use vars qw/$USE_HTML $TIME_START $GRAND_TOTAL $SECOND/;
5) reinstall the plugin.

Hope that helps.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
I'll give it a shot. Thanks. I'm heading out of town, so it may take me a week or to. But I'll try and post back here with results. Thanks again!
Post deleted by Evoir In reply to
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
I believe I have it installed successfully. Smile

Now, how do I link to that second detailed page? What do I put in my detailed page to link to second detailed, and what do I put in second detailed to link back to detailed?

I use a static site.

Thanks!
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
If your first detaild page is called 123.html, then the second detailed page will be called 123-2.html. It will reside in the same diretory (probably Detailed/).

So you could put something like
Code:
<a href="/Detailed/<%ID%>-2.html">Printer Friendly Version</a>
for linking to the second detailed page.

For linking back to the first detailed page, you could use
Code:
<a href="/Detailed/<%ID%>.html">Printer Unfriendly Version</a>

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
very helpful. Smile

and so obvious I am embarrassed. Thanks again.

Last edited by:

Evoir: May 12, 2002, 8:24 PM
Quote Reply
Re: [Evoir] Printer Friendly version? In reply to
Hi Everyone,

I installed this pluggin and it works great however it doesn't build the pages when I use BUILD CHANGED or BUILD STAGERED it only works with BUILD ALL. Can you please tell me what changes I have to make in order to get this to build the pages by clicking BUILD CHANGED and BUILD STAGERED ?

Thanks in advance,
PCMANIAK
Quote Reply
Re: [pcmania] Printer Friendly version? In reply to
That would involve setting a hook on "create_detailed_changed" and "create_detailed_staggered"

Try to add the following in Install.pm (sub install)
Code:
$mgr->install_hooks ( 'SecondDetailed', [ ['create_detailed_changed', 'PRE', 'Plugins::SecondDetailed::create_second_detailed', 'FIRST'] ]);
$mgr->install_hooks ( 'SecondDetailed', [ ['create_detailed_staggered', 'PRE', 'Plugins::SecondDetailed::create_second_detailed', 'FIRST'] ]);

I haven't tested this, but it might work. Tell me how it goes.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
Hi Yogi,

I keep getting errors when I add the above to my install.pm file, I can't even download it to the plugin section of LinkSQL, can you please add the above lines to your Plugin file and upload it here so I can download it and test it?

Thanks again,
PCMANIAK
Quote Reply
Re: [pcmania] Printer Friendly version? In reply to
OK here is the new plugin, as an attachement (I couldn't edit the old post...)

Anyway, it was straightforward (as I said, add the two lines to sub install in Install.pm, surely that cannot be so difficult...)

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
Yogi,

your plugin works very well. Is there any way to get this plugin added to the list of plugins for LSQL on GT? so that it shows up in the download manager? I just think that would be nice, so other folks can use this resource that you have shared. Just a thought.

Last edited by:

Evoir: Jun 6, 2002, 1:39 PM
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
Yogi,

I could not make this work in Dynamic mode - any ideas?

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Printer Friendly version? In reply to
This plugin doesn't work in dynamic mode. But since you own the PageBuilder plugin, you can just use that plugin to create a 'link' type page which contains your printer-friendly layout.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
Yogi,

Thanks - worked it out - it is perfect - seems I am still not fully aware of the power of PageBuilder..


Klaus

http://www.ameinfo.com

Last edited by:

klauslovgreen: Dec 27, 2002, 11:33 PM
Quote Reply
Re: [yogi] Printer Friendly version? In reply to
Can this plugin be modified to create the second detailed page based on the Title of the link? I know a redirect rule can do a similar thing, but this plugin would be more elegant.

--------------------------------
Privacy Software
Quote Reply
Re: [BLOOD] Printer Friendly version? In reply to
You can use the pagebuilder plugin to create as many detailed pages as you like. It would require a bit of code change to allow the title to be used as the file name, though.

I personally find rewrite rules more elegant.Cool

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [BLOOD] Printer Friendly version? In reply to
Hum.... why not try a simpler method ? Check out the option at http://www.needscripts.com/Resource/1084.html and let me know if you are interested, I would be glad to point you in right+freeware direction.

Vishal
-------------------------------------------------------
Quote Reply
Re: [pcmania] Printer Friendly version? In reply to
I agree. This makes sense. But wont this be content duplication in the eyes of search engines or is it alright ?
>> Nakul Goyal (SEO, Link Building Expert)
Web Site Promotion
Tips 'n' Tricks
SEO News


Quote Reply
Re: [nakulgoyal] Printer Friendly version? In reply to
The option I am using won't be considered dupilicate content for search engines. :)

Vishal
-------------------------------------------------------
Quote Reply
Re: Printer Friendly version? In reply to
Sorry to bring up such an old thread...

Got it working great.
Anyone know how to build the second page in another directory? Id like to have it under webroot... :)

Hope someone has done this before.

Thanks in advance,

Juan Carlos
Quote Reply
Re: [Gorospe] Printer Friendly version? In reply to
Anyone noticed that installing this plugin breaks the breadcrumb line in BOTH detailed.html and detailed2.html pages... ??
Quote Reply
Re: [Gorospe] Printer Friendly version? In reply to
Hi,

I would recommend probably just using mod_rewrite (as its never a good idea to have too many files in your root folder =)).

You got an example of these pages? (so I can come up with a rewrite for you =))

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] Printer Friendly version? In reply to
Hi Andy, thanks for your time, again.

The pages are located in:
http://www.domain.com/Detailed/4.html and http://www.domain.com/Detailed/4-2.html

They are not linked to each other. One has reserved info, the other shows 100% info.

Ideally I would like the -2.html to be created outside of webroot. Or actually, you know what... a simple cut and paste would also work and would probably be much simpler... How do I make a .bat file in linux with the cut and paste commands?

Sometimes a simpler method is easier...

What about the breadcrumbs? Any clue on that? I verified that installing that second page plugin breaks it, and uninstalling it makes it work again.

Juan Carlos
Quote Reply
Re: [Gorospe] Printer Friendly version? In reply to
Hi,

In the SecondDetailed.pm file, try changing:

Code:
$page = $CFG->{build_detail_path} . "/" . $link->{'ID'} . '-2' . $CFG->{build_extension};
$url = $CFG->{build_detail_url} . "/" . $link->{'ID'} . '-2' . $CFG->{build_extension};
..to:

Code:
$page = $CFG->{build_root_path} . "/" . $link->{'ID'} . '-2' . $CFG->{build_extension};
$url = $CFG->{build_root_url} . "/" . $link->{'ID'} . '-2' . $CFG->{build_extension};

That shoudl do the trick :)

Quote:
What about the breadcrumbs? Any clue on that? I verified that installing that second page plugin breaks it, and uninstalling it makes it work again.

The breadcrumbs on the normal page, or the second detailed page?

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] Printer Friendly version? In reply to
both detailed pages break..

I test the code right now.
Thanks
Quote Reply
Re: [Gorospe] Printer Friendly version? In reply to
Mmm.. not sure, would need to test it out at some point, to see whats going on.

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] Printer Friendly version? In reply to
Andy wrote:

Code:
$page = $CFG->{build_root_path} . "/" . $link->{'ID'} . '-2' . $CFG->{build_extension};
$url = $CFG->{build_root_url} . "/" . $link->{'ID'} . '-2' . $CFG->{build_extension};


Ok, made the change and it builds on the http://www.domain.com/page-2.html path.
I want it outside the web server.
So the path would be something like /home/me/somedirectory/page-2.html and not in /home/me/domain.com/public_html/page-2.html

Make sense?
Quote Reply
Re: [Gorospe] Printer Friendly version? In reply to
Hi,

Just change:
Code:
$page = $CFG->{build_root_path} . "/" . $link->{'ID'} . '-2' . $CFG->{build_extension};
$url = $CFG->{build_root_url} . "/" . $link->{'ID'} . '-2' . $CFG->{build_extension}
;

...to:

Code:
$page = "/home/me/somedirectory/" . $link->{'ID'} . '-2' . $CFG->{build_extension};
$url = "/home/me/somedirectory/" . $link->{'ID'} . '-2' . $CFG->{build_extension};

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] Printer Friendly version? In reply to
Worked great Andy, thank you.

Only if the breadcrumbs would work too.... At least in the original detailed page...

Juan Carlos
Quote Reply
Re: [Gorospe] Printer Friendly version? In reply to
This modified .pm file should make the breadcrumb available :)

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] Printer Friendly version? In reply to
Hi Andy,
Thanks, but it breaks. Maybe because the second detailed is building it outside the webroot?
Here is what it says:

Bareword found where operator expected at SecondDetailed.pm line 79, near "/home/jcgorosp"
(Missing operator before jcgorosp?)
Bareword found where operator expected at SecondDetailed.pm line 80, near "/home/jcgorosp"
(Missing operator before jcgorosp?)
syntax error at SecondDetailed.pm line 79, near "/home/jcgorosp"
Global symbol "$url" requires explicit package name at SecondDetailed.pm line 80.
syntax error at SecondDetailed.pm line 80, near "/home/jcgorosp"
SecondDetailed.pm had compilation errors.

Thanks
Quote Reply
Re: [Gorospe] Printer Friendly version? In reply to
Please PM me your .pm file, and I'll take a quick look :)

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!