FlexLayout

<< | Cookbook-V1 | >>

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Provide a mechanism to adjust page layouts based on CSS.

Solution

=note Note: PmWiki versions 0.6 and later already have page layouts based on CSS.

Change the values, and to a lesser extent the meaning, of the page layout variables, and placed CSS IDs on all page elements.

Attach:flexlayout.tgz - code and sample stylesheet (fixed 06-Feb-2004 by <#>?)
Attach:flexlayout-i18n.tgz - Internationalized version, 10-Aug-2003
(requires PmWiki 0.5.16 or later, plus i18n files)

Discussion

FlexLayout makes it easy to stylesheet a wiki site. It comes with a default stylesheet that is very close the original appearance. You can also see a "live" example [(approve links) edit diff]. I also made a minor change to make the "web menu" (see the next page) possible. I will be uploading that as a separate addon.

To use FlexLayout, put flexlayout.php in your local/ folder, and pmwiki.css in your pmwiki directory (because of the way PmWiki protects the local/ directory, you can't put the stylesheet there). Then in your local.php, add the line include_once("local/flexlayout.php");. That's it!

To customize the layout, create a new file in your pmwiki directory called local.css and place the new style definitions there. That will allow you to upgrade the addon without losing your changes.

I managed to keep the css files in the local directory. What is the problem? --Bernhard Weichel

PmWiki/PmWiki is distributed with a .htaccess file that is supposed to deny all access to files in the local directory, to prevent users from executing those scripts directly. --<#>?

Would it be possible to deliver a .htaccess which allows to access css files. Just to maintain the principle that all local customized files are in /local. --Bernhard Weichel

It's possible. Add three lines (the middle three in the following listing) to .htaccess in your /local directory: -- Hagan Fox

 Order allow,deny
 <Files *.css>
   Allow from all
 </Files>
 Deny from all

I also have a problem with wikitext (otherwise, this works great). I notice that the DIV wikitext (defined in flexlayout.php in TextStartFmt and TextEndFmt) doesn't seem to make it from its definition in flexlayout.php to the final page (although a different wikitext element, specifically TD, appears in the rendered page--this must be the default from pmwiki.php).--Paul (pmwiki@paulwelty.com)

help!,I install webmenu on my pmwiki site and want to build a Chinese Nav menu,but it fail,my website is [(approve links) edit diff] and the webmenu is here [(approve links) edit diff] I'm still track the bug now :( I am available at maoj [snail] mail [period] las [period] ac [period] cn

A reminder, if you have errors at top about headers already being sent, make sure there are no spaces after the ?> that closes local.php.

Requires PmWiki 0.5 or later.

How can I modify flexlayout.php to include a "preview" option on the "edit" page?

In $PageEditFmt
change: input type='hidden' name='action' value='post' />
to: <input type='hidden' name='action' value='edit' />

under the line: <td id='wikiheadercommands' valign='bottom'>
add: <input type='submit' name='preview' value=' Preview '/>
change: <input type='submit' value=' Save'/>
to: <input type='submit' name='post' value=' Save'/>

In $HandleEditFmt
under the line: "wiki:PmWiki.EditQuickReference",
add: &$PagePreviewFmt,
--John Feezell

See Also

WebMenu

Contributors

  • Jason Perkins
  • Patrick Michaud - i18n modifications (requires 0.5.16 or later)

pmwiki-2.3.32 -- Last modified by {{}}?

from IP: 85.171.160.186 ip should be disabled by default for security reasons