I improved the script php_manual_prefs.js provided with the extended chm-version to better hilight user comments and code samples as I found those in the original version too dull (gray). Note that this all cannot be done using stylesheets only as the code samples in the chm-docs do not have any distinct classes etc and can only be parsed with a script. What I added to the original script follows. The timeouts are used because the page is not loaded right at once so we have to wait for complete loading. The colors (aColorMap) can be customized. This also improves navigation links positioning in short pages, so instead of directly following contents they are now bottom-aligned. This fix needs some extra styles so they follow the code, along with some general styles.
setTimeout("AddStyles(); window.focus();", 50);
//-----------
var D, TimerId, oNav, oPage;
function AddStyles(){
D=document; ChangeExamples(); ChangeNotes();
}
function ChangeExamples(){
var aDivs, DivNo, oDiv, aSpans, SpanNo, oSpan, aColorMap, Color, aCodes;
aColorMap=[];
aColorMap['#007700']='yellow';
aColorMap['#0000bb']='white';
aColorMap['#dd0000']='yellow';
aColorMap['#ff8000']='Aqua';
//aColorMap['']='';
//Scan examples
aDivs=D.getElementsByTagName('DIV');
for(DivNo=0; DivNo<aDivs.length; DivNo++){
oDiv=aDivs[DivNo];
if (oDiv.className!='examplecode') continue;
//Change colors
oDiv.style.backgroundColor='black';
oDiv.style.backgroundImage='none';
//oDiv.style.color='white';
aSpans=oDiv.getElementsByTagName('SPAN');
for(SpanNo=0; SpanNo<aSpans.length; SpanNo++){
oSpan=aSpans[SpanNo];
Color=oSpan.style.color;
oSpan.style.color=aColorMap[Color];
if (Color=='#dd0000') oSpan.style.backgroundColor='DarkRed';
oSpan.style.fontFamily='Lucida Console';
}
aCodes=oDiv.getElementsByTagName('CODE');
for(SpanNo=0; SpanNo<aCodes.length; SpanNo++){
oSpan=aCodes[SpanNo];
oSpan.style.color='yellow';
oSpan.style.fontFamily='Lucida Console';
}
}
}
function ChangeNotes(){
var oNotes, oDiv, aDivs, DivNo, oP, aPs;
oNotes=D.getElementById('pageNotes');
if (!oNotes){
setTimeout('ChangeNotes();', 100); return;
}
aDivs=oNotes.getElementsByTagName('DIV');
for(DivNo=0; DivNo<aDivs.length; DivNo++){
oDiv=aDivs[DivNo];
aPs=oDiv.getElementsByTagName('P');
oP=aPs[0];
oP.style.backgroundColor='DarkGreen';
oP.style.color='yellow';
oP.style.marginBottom='0px';
oP=aPs[1];
oP.style.backgroundColor='LightYellow';
oP.firstChild.style.fontFamily='Lucida Console';
//oP.firstChild.style.fontSize='12px';
oP.style.border='1px solid DarkGreen';
oP.style.borderTopWidth='0px';
}
//return;
oNav=D.getElementById('pageNav');
oPage=D.getElementById('pageContent');
AlignNav(); window.onresize=AlignNav;
}
function AlignNav(){
var Pos, NavBottom, Diff;
Pos=AbsPos(oNav);
NavBottom=Pos[1]+oNav.offsetHeight;
Diff=oPage.offsetHeight-NavBottom;
if (Diff!=0) oNav.style.top=(Diff+oNav.style.posTop)+'px';
}
function AbsPos(O, Parent){
var X=0, Y=0, Next;
Next=O; if (Parent==null) Parent=D;
while (Next!=null && Next!==Parent){
Y+=Next.offsetTop; X+=Next.offsetLeft; Next=Next.offsetParent;
}
return [X, Y];
}
//----------
This is to be added in style.css:
Body{
font-family: Verdana;
font-size: 80%;
height: 100%;
}
P{
text-align:justify;
}
#pageContent{
height: 100%;
}
#pageNav {
position:relative;
}
.literal{
background-color: LightCyan;
}
TR.question TD{
background:LightYellow;
}
TR.answer TD{
background:#F0FFF0;
}
About the manual
Table of Contents
- About user notes
- How to read a function definition (prototype)
- PHP versions documented in this manual
- How to find more information about PHP
- How to help improve the documentation
- How we generate the formats
- Translations
Formats
The PHP manual is provided in several formats. These formats can be divided into two groups: online readable formats, and downloadable packages.
Note: Some publishers have made available printed versions of this manual. We cannot recommend any of those, as they tend to become out-of-date very quickly.
The manual can be read online at the » PHP.net website, and on the numerous mirror sites. For best performance, choose the closest mirror. The online version of the PHP manual has currently two CSS stylesheets, web friendly and a printer-friendly stylesheet.
Two notable advantages of the online manual over most of the offline formats is the integration of user-contributed notes and the » URL shortcuts that may be used to get to the desired manual parts quickly. An obvious disadvantage is the requirement to be online to view this edition of the manual.
There are several offline formats of the manual, and the most appropriate format for depends on the operating system, and personal reading style. For information on how the manual is generated in so many formats, read the 'How we generate the formats' section of this appendix.
The most cross-platform format of the manual is the HTML version. This is provided both as a single HTML file and as a package of individual files for each section (which results in a collection of several thousand files). We provide these versions compressed, so a decompression utility is required to retrieve the files contained within the archives.
For Windows platforms, the Windows HTML Help version of the manual enhances the HTML format for use with the Windows HTML Help application. This version provides full-text search, a full index, and bookmarking. Many popular Windows PHP development environments also integrate with this version of the documentation to provide easy access. CHM viewers for Linux desktops are also available. Check out » xCHM or » GnoCHM.
There is also an » extended CHM version available, which is updated less frequently, but provides many additional features. It will only work on Microsoft Windows though, because of the technologies used to build the help pages.
About the manual
21-Aug-2007 05:38
