RemovingLeftContent

Summary: Removing left or right part of the layout
Version:
Prerequisites:
Status:
Maintainer:
Categories: Obsolete

Goal

Removing left or right part of the layout, in the same manner as the (:nofooter:) and (:noheader:) directive (no sidebar, for example).

Solution

The (:noleft:) and (:noright:) directives are included by default in 2.0.beta44.

Create the directive (:noleft:) by writing in the config.php file :

 
Markup('noleft','directives','/\\(:noleft:\\)/e',
  "PZZ(\$GLOBALS['PageLeftFmt']='')"); 

If you have set content in the right part of your layout that you wish to remove temporarily, you can create a (:noright:) directive as well :

 
Markup('noright','directives','/\\(:noright:\\)/e',
  "PZZ(\$GLOBALS['PageRightFmt']='')"); 

From pmwiki2 beta22 onwards you can write instead:

 
     Markup('noleft', 'directives', 
       '/\\(:noleft:\\)/e', "SetTmplDisplay('PageLeftFmt', 0)");

     Markup('noright', 'directives', 
       '/\\(:noright:\\)/e', "SetTmplDisplay('PageRightFmt', 0)");

     Markup('noheader', 'directives', 
       '/\\(:noheader:\\)/e', "SetTmplDisplay('PageHeaderFmt', 0)");
 

etc.

Alternative Solution

For pure css layouts which do not use a table in the page template for positioning of the left content and main content.

Create the directive (:noleft:) by writing in the config.php file :

 
function NoLeftBar() {
     global $HTMLStylesFmt, $PageLeftFmt;
     $PageLeftFmt = '';
     $HTMLStylesFmt[] = "#main { margin-left:0; }\n";
     return '';
   }

  Markup('noleft','directives','/\\(:noleft:\\)/e', "NoLeftBar()");

#main is the name of the element (often a division, but could also be the body) which usually includes a wide left margin to give space for the left column. You may need to substitute the name for this main content element to the one you are using.

Discussion

I did it in a different way - maybe for a different purpose: I removed all sidebar issues in the used marathon.tmpl file and modified the CSS slightly too. Maybe a bit too rude, but it works. I've my PmWiki running for less than a week and a month ago I even did not know what a Wiki is...

My purpose is to use parts of my PmWiki installation as a CMS. Some WikiPages are running in a conventional HTML frame, where an additional sidebar would look stupid, because there is already a more sophisticated one for navigation on the left frame. For comfortable editing and navigation in my WikiPages, I just use the SkinChange way ?setskin=marathon, while for viewing in the frameset I use the same one (with another name: hsg) with removed sidebar code lines and modified CSS file. In case s.o. is just reading my homepage the pages are linked with ?setskin=hsg and I (administrator) use the default marathon skin.

In case of interest I can add my URL here for demonstration.

--Armin

Is there a way to deactivate PageLeftFmt from within config.php? - Klonk

What do you mean by "deactivate PageLeftFmt"? --Pm
Well I want to be able (or change my skin accordingly) to disable or hide the complete area that could be found within the PageLeftFmt section without editing the skin .tmpl file. - Klonk
If you do the same action as the markup, it should work --PRZ :
          $PageLeftFmt = '';
          $HTMLStylesFmt[] = "#main { margin-left:0; }\n";
 
I tried this already - doen not work, other suggestions? Klonk
add: (this is not necessary from pmwiki2 beta22 onwards. $BasicLayoutVars has been deprecated. --HansB)
       global $BasicLayoutVars;
      SDV($BasicLayoutVars,array('HeaderText','PageHeaderFmt',
	 'PageTitleFmt','PageText','PageRightFmt','PageFooterFmt')); 

normally this array contains 'PageLeftFmt'. Giving it a new value in config.php or a customskin.php will override the default. This is also the place to add any custom Page...Fmt area you like to create in the template file. If you need to shift the left margin of your main block you may need this too:
$HTMLStylesFmt[] = "#main { margin-left:0; }\n";
#main being the name of the division or element which is holding a wide left margin. ~Hans

Q. Could you suggest an Alternative/Example for PageLeftFmt=? that can be inserted in config.php file. ~V Krishn

Q. is it possible to make a link-(like button) 'hide/open the leftBar' in a page ? Thanks --Pierre79

Contributors

Pm CSS version

None of this works for me - Johannes