is always the outermost tag around the html content that returns
from ewiki_page(). It will always contain the class "wiki", after this
the current page action/ and PageName (the action is usually "view", but
can be also "edit", "info", "links" or something similar).
If you haven't seen that before, this is in fact valid CSS. It means that
this
is part of three classes. You can then use either ".wiki" or
".view" or ".PageName" or any compound of the three like ".wiki.view.PageNm"
as selectors in your stylesheet.
Note: Non-word characters in page names are converted into '-' dashes
usually (including dots and spaces, underscores, and so on), consecutive
dashes are collapsed. If a page name originally started with a number,
then "page" will be prepended to it.
So for example "99BottlesOfBeer.en" became "page99BottlesOfBeer-en" in
the stylesheet.
Keeping this in mind you can easily style all, a few or even just a single
page from ewiki in your stylesheet. (We'll explain it here, because the word
of multiple class names and the cascading way of using CSS is not very
widespread.)
.wiki { // this affects every page ewiki returns
background-color: #ccccff;
font-family: "WikiFont";
...
}
.wiki.view { ... } // only applies to pages that are "view"ed
.wiki.links { ... } // BackLinks
.wiki.edit { ... } // when a page gets edited
.wiki.PageIndex { // this rule affects only a __single__ page
... // regardless what the "action/" is now;
} // useful for "PowerSearch" or "PageIndex"
.wiki.edit.ThisVerySpecialPage { // this css section applies to just one
... // page again, and this time only when
} // it gets edited
page style class fragmentation
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Moreover inside that generic
the page is fragmented further into
its individual parts to make styling it only partially really simple:
here comes the
actual page content
...
So the .wiki class itself is divided into three parts, where .text-head
typically only contains the headline (.text-title) and the actual page
content comes encapsulated in .text-body
The part following as .wiki-plugins contains the individually named output
blocks from the so called aview-plugins, one of it is the .control-links
block containing the EditThisPage, BackLinks, ... actions and control links.
But there may be more of it inside of the .wiki-plugins block. See also
the paragraph on "plugin output styling".
Likewise the .text-head block could contain more, but currently no plugin
throws other output above the page content or title.
This further separation allows you for example to give headlines or page
content different borders or margins than the action links, so that it
matches better into your layout. You however don't need to use that classes
at all and could simply apply all styles onto the complete .wiki selector
as usual.
rendered page content
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
If you are not interested in walking around the "ewiki.php" script
when you want to tune how the output looks, you should try to
utilize the (few) CSS classes ewiki defines (it does not include
even one color setting or
tag):
user style classes in pages
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
The plugins/markup/css allows you to use CSS classes and style definitions
in WikiPages. With the double at "@@" followed by a css classname or command
you start styling a paragraph or parts of the text.
@@classname at the start of a paragraph will
enclose it into a
completely
But inside of some text, the @@styledef only
affects the part until the next @@ - everything
that comes later won't be enclosed in a
While the css style classes must be defined in your sites` global stylesheet
to take effect, you could also use direct CSS style commands instead. These
also must follow the @@ immediately and may not contain spaces. So something
like @@color:#ff0000; will work, while specifying font names may not always.
plugin output styling
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
There often appear special 'pieces' within a rendered page that ewiki
returns, because not everything in the returned html code belongs to the
requested pages` content.
For example the current pages` title needs its own css class, like does
the block of action links ("EditThisPage, PageInfo, ...") below every page,
so it can be distinguished from the pages` text.
Also note again the use of the '.wiki' selector within the following
stylesheet guide and ewiki CSS class overview:
.wiki h2.page.title { // all titles now have it, while many
... // of them include links as well
}
.wiki.view .action-links { // "EditThisPage, PageInfo, ..." links
... // are inside such a block, like are two
} //
's
.wiki.info .chunked-result { // some generated pages (like the history
... // info/ ones) may need to split their
} // results; this matches those links
//-- the edit/ pages are separated into
// following blocks:
.wiki.edit .edit-box { ... }
.wiki.edit .image-upload { ... }
.wiki.edit .preview { ... }
//-- info/ pages contain a history of page versions, each enclosed in
// a , the s inside can be selected
// separately:
.wiki.info table.version-info { ... }
.wiki.info .version-info .action-links { ... }
.wiki.info .version-info .page-author { ... }
.wiki.info .page-refs { ... }
.wiki.info .page-flags { ... }
The class naming across most of the extension plugins is not unified, so you
may often need to look it up here - or inside of the plugins source code.
This is at least necessary for calendar and navbar, which follow a very
different naming scheme.
.wiki .download-entry { ... }
.wiki .download-form { ... }
.wiki .upload-form { ... }
.wiki .image-append { ... }
-------------------------------------------------------------------- 5 --
Explanations
ŻŻŻŻŻŻŻŻŻŻŻŻ
The next few paragraphs shall enlight more detailed how some things are
handled in ewiki (and why it is that way).
Binary and Text content
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Because I'd like to keep it small (see also the "Everything in one
script" paragraph) ewiki also creates just one database table.
Differently from other Wikis this one has the 'flags' setting for
each saved page. And as I successfully used this bad trick in earlier
projects many times to integrate support for hundreds of different
functions (CMS, links, boards/forums, ...) into a single table; I
thought it could be funny to have something like this in ewiki too.
While the image thingi seemed senseful to me, other binary data
cannot be feed into database without helper plugins, because this is
a Wiki script and not an almighty portal software!
Uploading and caching of images requires the EWIKI_SCRIPT_BINARY
constant to be set correctly (no output may be made before "ewiki.php"
is included == "binary safe").
The ewiki_binary() function handles almost all of this, and gets
activated automagically (whenever required) as soon as ewiki.php is
included().
I believe these functions to be rather safe, as there are many sanity checks
throughout the code to separate between _DB_F_BINARY and _DB_F_TEXT content.
Image Uploading
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
The currently most important use for the BINARY flag and image
functions is to upload images with the small form below every page
edit box.
The upload/caching functions can be disabled fully if
EWIKI_SCRIPT_BINARY and EWIKI_CACHE_IMAGES are set empty (or zero).
URLs starting with "internal://" represent the uploaded files. The
string is just a md5() sum generated from the contents of the
uploaded file. This way files won't get saved another time if they
are uploaded twice. For uploading a JavaScript-capable browser is
recommended. It will work without, but then requires the user to
copy the [internal://...] text (from one window to another).
The color of the temporary upload info screen can only be changed
inside the ewiki_binary() function, currently.
Beware that images usually get downscaled if they are larger than
specified with EWIKI_IMAGE_MAXSIZE (per default 64K).
Images Caching
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Images are usually redirected through EWIKI_SCRIPT_BINARY, and ewiki
tries to save them inside the database as with uploaded images. So
most of the facts from the previous paragraph apply to this function
too.
You must enable this feature with EWIKI_IMAGE_CACHING, it is shipped
disabled currently.
Adding a ?nocache to the image URL disables this feature for just one
specific image, if _IMAGE_CACHING was otherwise enabled.
Images are downscaled to fit the maximum defined size in
EWIKI_IMAGE_MAXSIZE (bytes) if the PHP libgd extension is available
(else dropped and then always redirecting clients which request
those image).
Image WikiMarkup
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Usually one writes image references using square brackets around the
url of an image: [http://www.example.com/pics/image.png] or:
[internal://md5md5md5md5md5md5md5md5md5md5md5md5.png]
This will include (inline) the image into the page, when rendered
and viewed. Using the standard square bracket link entitling syntax
also image references can be named (non-graphics / alternative
text):
[http://www.example.com/pics/image.png | This is an example image]
[http://.../image.pic "or entitle it using double quotes"]
Images can also be "aligned" to either side of the screen, thus the
remaining text will flow around it. To achieve this include spaces
to the left or the right of the image URL:
* picture to the LEFT: [http://www.example.com/pics/image.png ]
* picture to the RIGHT: [ http://www.example.com/pics/image.png]
* CENTRED picture: [ http://www.example.com/pics/image.png ]
Note that you must use __two__ spaces, currently!
Image rescaling is possible by appending x=... and y=... as query
string parameters behind the image URL:
[http://www.example.com/pics/image.png?x=160&y=120]
The query string parameters "width" and "height" are also accepted.
If you have an image URL, but you do not want to get that image
inlined into the current page, then just leave out the square
brackets around.
binary_store, direct access
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
While storing the binary data together with text pages in the same
database is most often a good thing and suits most sites, there
exists also a workaround/hack to keep this binary data in plain
files. The advantage is a smaller database and possibly a little
speed enhancement (with a large collection of binary things in the
db). However the drawback is, that use of plugins/binary_store is
only transparent to the main ewiki script, but all admin tools/
won't be aware of it.
If you choose to use the binary_store.php plugin, you can also let
ewiki generate URLs directly to the then stored data files if you
just set the EWIKI_DB_STORE_URL constant.
Please see the paragraph on this plugin for more informations on
this.
Arbitrary Binary Content
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Set the EWIKI_ACCEPT_BINARY constant, if you'd like to allow any
binary file to be uploaded and saved in the database using the image
upload function. Uploaded files will show up as ordinary (except
that "internal://" href prefix) links.
Please also note the "plugins/download.php", which does a much
better job than this constant.
$action and $id
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Inside of ewiki.php you'll see many occurrences of variables named $id and
$action. The $id refers to the current page, which usually is a string like
ThisPage, ThatPage, OrAnotherPage.
Because just having pages wasn't believed to be sufficient enough, there
is also a way to do something with them. That is what the $action tells.
The most often used $action is "view" and is automatically assumed when
no other $action was specified in the current ewiki URL. For non-existent
pages alternatively the "edit" $action may get used instead.
So the $action now delegates control about a requested page to a subfunc
or plugin of ewiki, so the stored data of the page can be used for
something (viewing being again the most common thing to do with it).
"action/ForTheCurrentPage" is how both often looks in conjunction (again:
if there is no "$action/" then "view/" will be assumed). Here the $action
appears in front of the page name separated by a slash. A pagename now can
contain slashes too, because ewiki can figure out, that "view/That/Page"
separates into the $action being "view" and $id is "That/Page" in this
example (the "view" gets mandatory in such cases).
ewiki URLs
ŻŻŻŻŻŻŻŻŻŻ
"$action/$id" is most commonly appended as "GET parameter" to an
ewiki URL, after a string like "?id=" or "?page=" - you've already
noticed that!
There are of course other ways to design the URLs ewiki produces
and uses, the PATH_INFO being one of the most favoured alternatives.
(we had a paragraph on this earlier, see on top of this README)
Other Wikis use different URLs too, but you can tweak ewiki easily
to a different behaviour, because you have the chance to pass your
$action and $id to ewiki_page() from different sources. And because
URL generation is encapsulated into the function ewiki_script()
you could easily change just a few lines to make them look like you
desire.
The $action can be passed as "?action=" parameter already (this is
core support), so URLs could for example look like
".../my/wiki.php?id=ThisPage&action=view" ... or something alike.
-------------------------------------------------------------------- 6 --
Appendix
ŻŻŻŻŻŻŻŻ
This sections lists things, that in fact have little to do with ewiki.
Apache config
ŻŻŻŻŻŻŻŻŻŻŻŻŻ
You must of course configure your Apache (or any other Webserver) to
feed .php scripts through the PHP interpreter, either libphp (Apache)
or the standalone CGI PHP interpreter.
If your Webserver supports mod_rewrite (Apache, Nanoweb), you may wish
to use it for URL beatification as described in "fragments/htaccess".
PHP config
ŻŻŻŻŻŻŻŻŻŻ
ewiki relies upon various settings of the PHP interpreter, which either
can be changed with entries in the php.ini or via option settings from
within .htaccess (only if you have Apache with libphp running).
A .htaccess option setting looks like:
php_option register_globals off
while in the "php.ini" you would just write:
register_globals = off
The recommended settings are:
magic_slashes_gpc = off ; This was enabled for old PHP versions
; to help newbies writing more secure
; scripts in regards to database access (makes you wonder, which
; newbie actually could deal with databases). Nowadays this setting
; is still enabled by some providers, which try to keep their buggy
; site running.
; As a workaround (SlowSlowSlow, and not WikiWiki!) you can use
; fragments/strip_wonderful_slashes.php
magic_quotes_runtime = off ; This is even more awful than the above,
; and if you cannot disable it, then you
; should not run ewiki on your Webserver. It is not believed to
; work correctly with that setting.
register_globals = off ; This setting is a security risk, if kept
; enabled, because ewiki was written on a
; system where it is disabled (like with all newer PHP versions).
; It once was a very convinient setting, but the PHP language has
; long lost its sinmplicity and ease.
register_argc_argv = on ; is important for 'ewikictl' & Co.
safe_mode = off ; The so called 'Safe Mode' was introduced
; for mass hosters, which didn't want to
; deal with security guidelines and needed an easy way to "secure"
; their servers. This setting cripples various PHP functions, and
; thus will disallow to use multiple ewiki extensions. The Safe
; Mode renders it completely useless and stupid to run a webserver
; on the Unix/Linux plattform, because its strenght was to invoke
; the various fast utilities and filters through pipes. And the
; lack of this opportunity then disables many ewiki extensions.
allow_url_fopen = on ; You will need these, if you want ewiki
file_uploads = on ; to deal with image caching and file
; uploads (of course).
error_reporting = ... ; You should preferrably have this disabled,
; even if ewiki.php already carries an
; error_reporting() call to do exactly that.
; The ewiki code is clean, but no longer cares about PHP "Notices"
; and sometimes also "Warnings" that much.
cgi.force_redirect = 0 ; This is a stupid PHP option, that is only
; there to fix a "/cgi-bin/ install" of PHP.
cgi.fix_pathinfo = 0 ; PHP scrambles the PATH_INFO if you keep
; this enabled. However Apache 1.3 often
; returns a broken value, so this may not matter to you anyhow.
cgi.rfc2616_headers = ... ; If you don't have Apache 1.3 running
; (any earlier versions would do, and laters
; will be fixed again), then you should enable this; though ewiki
; does not rely on it.
short_open_tag = ... ; ewiki does NOT care
output_buffering = ... ; ewiki does NOT care
error numbers
ŻŻŻŻŻŻŻŻŻŻŻŻŻ
A few ewiki error messages are kept uninformative to prevent abuse of
security (misconfiguration) leaks through visitors. Usually you will find
an error number besides (in the tradition of OS/2 ;-), which you can then
lookup here:
ERROR #0257: is triggered by fragments/strike_register_globals to signalise
that your PHP interpreter is still configured with register_globals
enabled. The whole purpose of fragments/strike_... is to prevent variable
injection from outside. Suddenly this is what happened if you've seen this
message - but if you've discovered it yourself, then the reason for this
security problem is a bogus extension plugin, which simply tried to
reinsert values from one innovocation to another in a non-standard (too
direct) way.
Simply disable register_globals and unload the fragments/strike_...
script to get rid of this error.