RE: new "print this page" functionality
| From: | Mitja Slenc | Date: | Fri, 07 Jun 2002 15:21:11 +0000 |
| Subject: | RE: new "print this page" functionality | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-10721@lists.php.net to get a copy of this message | ||
Hi!
I like your idea. Half less files is definitely a good thing. I have an
idea, though:
Why not process the non-print version (which is processed anyway), and
leave the printable version in HTML, as it is now, so it doesn't need to
be PHP processed - this provides for less load on servers. It could be
achieved with something like:
<!--<? man_top(...); if ($print) { ?>-->
print-only stuff
<!--<? } ?>-->
stuff common to both
<!--<? if (!$hidenotes) { ?>-->
notes
<!--<? } manualFooter(...); ?>-->
Notably, as the things are right now, this would require a lot of PHP in
the "HTML" version, but it can be helped by removing the function lists
from function pages and leaving only the bare minimum needed to function
(e.g., for strstr):
<!--<?man_top('strings', 'strspn', 'strtok',
array('ref.strings.php', 'Strings')); if (0) { ?>-->
is all that's really needed:
- the home link is the same on all the pages, so it
doesn't need to be specified
- first parameter specifies which of the indexes to show
on the left (e.g. they can be in index.param.html)
- the next 3 parameters are the "prev", "next" and "up"
links. if they are arrays, they function the same as
now, if not, a link to function.param.html is made.
if the up link and the section are always the same (I'm not
sure about this), even the last parameter could be
eliminated, making the whole thing just one line. Since
the source is publicly available, this would not be
a serious issue, as nothing new is revealed, and the
additional bandwidth required would be negligible.
Then, error.php would only need to do this:
- extract the language and send headers
- include() manual functions (man_top, etc.)
- include() the required file
Any thoughts?
Mitja
-----Original Message-----
From: Gabor Hojtsy [mailto:gabor@hojtsy.hu]
Sent: 7. junij 2002 15:41
To: webmaster@php.net
Subject: new "print this page" functionality
Hi!
I managed to implement one of my ideas regarding PHP.net.
There were so many problems with printeable files (extra
size to update the mirror, and to host it), so I decided
to implement this simple thing first to show how do I think
it would be easy to solve this problem.
http://www.php.net/manual/en/print/function.echo.php
The solution here is to introduce a new virtual "print" directory under
the manual directories (much like
how the html directories are phisically there now).
This can be handled with our error redirection tool,
pointing the request to
http://www.php.net/manual/en/function.echo.php
But two thing need to be preserved:
1) It's a page with "print design" on it.
2) If the user clicks on a link, it should bring
him to the next page in "printed design"
For the first thing, I have introduced the $PRINT_PAGE variable. If it
is set, the manual page shows up in the "printed design". To retain the
design the error handling is not performed with a redirect, but with an
include, so relative links are still relative to the virtual print
directory.
Note that this is in a testing phase, but it would
definitely be available to replace the html directories, speeding up
mirror updates significantly.
Possible options:
1) show navigation
2) show user notes (printable form)
3) collect links and print them in a list at the bottom
The first two are relatively easy to implement. They
are not implemented, because this is not the choosen
method to provide printed pages right now, and so I
decided not to invest too much work into it ;)
The third can be achieved with an output buffer, and then
a preg collecting all links from the text and printing
it out as a list at the bottom... I would like to ask you
guys if you think, that this would bog down the servers
(too much memory usage because of output buffers), or if
it's ok, and so can be implemented.
These may all be added to the print dir, but as this method
is quite flexible, we can invent any new names for new methods, like
"/manual/en/printwn/function.echo.php" for "print with notes", etc.
Goba