00211: own print.tmpl does not work

Summary: own print.tmpl does not work
Created: 2004-12-06 03:26
Status: Closed
Category: Bug
From: Klonk
Assigned:
Priority: 2
Version: 2.0 beta6
OS:

Description: see also 00198:

When adding

     $ActionSkin['print'] = 'test';

in my config.php still the old print layout is shown, not that one that resides in the test skin-directory.

Creating skin.php in the skin directory containing the above does also not result in usage of the new layout

So the new print.tmpl ist not loaded.

As far as I can see the routine SetSkin in skin.php does not handle actionskins (or are they handled somwhere else)? I dont't know too much about PHP, but I think the problem has to be searched somwhere there.


Hmmm, it's working for me. For example, on pmwiki.org I created local/Test.PrintSkin.php with the following:

    
    <?php
      $ActionSkin['print'] = 'jh';
    ?>
    

Visit Test.PrintSkin?action=print and you'll see that it does indeed use the jh skin for the print action instead of PmWiki's default.

  • Is there a URL I could look at for this?
  • Do you have caching enabled -- perhaps there a browser cache issue here somewhere?
  • Could you get me a copy of your config.php file?

--Pm


Sorry your link leads me to editing the file Test.PrintSkin. BTW I'm using Firefox (which normally should not matter).

Fixed, sorry about that--forgot to create the Test.PrintSkin page. --Pm

When inserting the above line in the config.php the only thing I get ia a new window with the same content, but no print preview. My print preview does not show referrer at the bottom and where this page is obtainaed fro on the top.

My configuration is a wikifarm. Here my farmconfig.php in pmwikwi/local:

 <?php
 ## Verzeichnisse und Standard-Template festlegen
	$Skin = 'lines';
	$ActionSkin['print']= 'lines';

      $FarmPubDirUrl = 'http://www.loncarek.de/pmwiki/pub';
	$PubDirUrl = $FarmPubDirUrl;

 ##  $WikiTitle is the name that appears in the browser's title bar
	$WikiTitle = 'loncarek.de';

 ##  If you want uploads enabled on your system, set $EnableUpload=1.
 ##  You'll also need to set a default upload password, or else set
 ##  passwords on individual groups and pages. 
	$EnableUpload = 1;
	$DefaultPasswords['upload'] = '';

 ## Maximale Dateigröße für Upload
	$UploadMaxSize = 300000;

 ## Standard CSS-Stil
	$HTMLStylesFmt['pmwiki'] = "
	a.createlink { text-decoration:none; position:relative; top:-0.5em;
	  font-weight:bold; font-size:smaller; border-bottom:none; }
	";

 ## Expression used to indicate that the page shall be deleted
	$DeleteKeyPattern = "^\\s*löschen\\s*$";

 ##-- Groups and pages to be excluded from searches ----------------
	$SearchPatterns['default'][] = '!\\.(All)?Recent(Changes|Uploads)$!';

 ##-- Page management ------------------
	$DefaultGroup = 'Haupt'; # Default group, default name 'Main'
	$DefaultName = 'StartSeite'; # Home page of any group, défault 'HomePage'
	$AuthorGroup= 'Profile'; # Name of authors group, default 'Profiles'

 #  By default, PmWiki doesn't allow browsers to cache pages.  Setting
 #  $EnableIMSCaching=1; will re-enable browser caches in a smart manner.
 #  However, you may want to have caching disabled while adjusting
 #  configuration files or layout templates.
 #	$EnableIMSCaching = 1;

 ## $DiffKeepDays specifies the minimum number of days to keep a page's
 ## revision history.  The default is 3650 (approx 10 years).
	$DiffKeepDays=30;                        # keep page history at least 30 days

 ## email Sicherheit
	include_once('scripts/e-protect.php');

 ## Deutsche Spracheinstellungen 
      XLPage('de','PmWikiDe.XLPageLokal');
	XLPage('de','PmWikiDe.XLPage');

 ## Weitere Übersetzungen:
	$TimeFmt = 'B H:%M Uhr';
	$DefaultPageTextFmt = '$Name? bearbeiten';
	$AuthDeniedFmt = 'Für den Zugriff is ein gültiges Passwort notwendig!';
	$RecentChangesFmt = array(
	  '$DefaultGroup.AlleKürzlichenÄnderungen' => 
	    '-> $Group.$Name?  . . . $CurrentTime von $AuthorLink',
	  '$Group.KürzlicheÄnderungen' =>
	    '-> $Name?  . . . $CurrentTime von $AuthorLink');
	$AuthorRequiredFmt = 'Geben Sie bitte Ihren Namen an!'; #When author name required

 ###	$AuthDeniedFmt = 'A valid password is required to access this feature.
 ###<p><a href="javascript:window.back()">Zurück</a></p>';

 ###$PageAttrFmt="<h1 class='wikiaction'>\$PageName Attributes</h1>
 ###  <p>Geben Sie nachfolgend die Eigenschaften ein. Ein leeres Feld ändert die vorhandenen Eigenschaften nicht. Um die Eigenschaften zurückzusetzen 'clear' eingeben.</p>";

 ## Aktivierung Umwandlung Smileys (Zusatzscript)
	include_once("scripts/smileys.php");

 ## Beim Editieren Author notwendig
	$EnablePostAuthorRequired = 1;
 ###	$AuthorRequiredFmt = 'Das Speichern dieser Seite ist nur mit Angabe eines Autors möglich!';

 ## Gallery auf Webseite ermöglichen (Zusatzscript)
 ###	include_once('scripts/x-gallery.php');
 ###	include_once('scripts/gallery.php');

 ## Einfach Kommentare eintragen
	include_once('scripts/commentbox.php');
 ## Übersetzungen bzw. Einstellungen zu commentbox
	$JPDateFmt = "!!!!!\$Date";
	$JPTimeFmt = "\n\n\$Time : ";
	$DPDateFmt = "!!!!!\$Date\n";
	$DPItemFmt = "\n*";
	$MPDateFmt = "!!!!!\$Date";
      $MPTimeFmt = "\n\n\$Time - \$Author : ";
 	$MPItemFmt = "\n----";

 ## Sicherheitseinstellungen
 # 	$DefaultPasswords['edit'] = array(crypt('secret'),crypt('mysecret'));
 # 	$DefaultPasswords['admin'] = crypt('mysecret');
 # 	$DefaultPasswords['attr'] = crypt('mysecret');
 ##	$DefaultPasswords['upload'] = crypt('secret');
	$DiffAccessLevel = 'edit'; ## Seitenhistorie nur, wenn Bearbeiten erlaubt.

 ## Bei Änderungen auf der Webseite email schicken

/* $EnableMailPosts=1; # to enable mailposts

	$MailPostsTo="webmaster@loncarek.de";  # where to send mail 
	$MailPostsFrom = 'Wiki loncarek.de';
	$MailPostsDelay=1800;                 # wait 30+ min after initial post
	$MailPostsSquelch=7200;               # require 2+ hours between mails
	$MailPostsItemFmt = " * \$PageName . . . \$PostTime von \$Author\n     \$PageUrl";
	$MailPostsSubject = 'PmWiki: Seiten wurden geändert!'; */
 ?>

when calling http://www.loncarek.de you are automatically redirected to http://www.loncarek.de/wiki/wiki.php .The config.php for that part of the farm see below:

 <?php
 ## Kompatibiltät zu PmWiki 1.x
 #    include_once("$FarmD/scripts/compat1x.php");
 #    UseV1WikiD("$FarmD/../wikialt/wiki.d");

 ## Script-directory einstellen (wichtig für korrekte Funktion bei Uploads)
	$UploadUrlFmt = 'http://www.loncarek.de/wiki/uploads';
 ## Sicherheitsfunktionen (Passwörter)
 	$DefaultPasswords['edit'] = '<removed>';
 	$DefaultPasswords['admin'] = '<removed>';
 	$DefaultPasswords['attr'] = ' ';
	$DefaultPasswords['upload'] = ' ';
 ?>

When clicking here on "Druckansicht" which should show the print preview a new window opens and the same page is displayed again.

You can also visit http://www.loncarek.de/test/wiki.php .Here you can see a different layout I'm currently working on. Here is the corresponding config.php:

 <?php
 ## Kompatibiltät zu PmWiki 1.x
 #    include_once("$FarmD/scripts/compat1x.php");
 #    UseV1WikiD("$FarmD/../wikialt/wiki.d");
 $Skin='test';
 $ActionSkin['print']='test';

 ## Script-directory einstellen (wichtig für korrekte  Funktion bei Uploads)
	$UploadUrlFmt = 'http://www.loncarek.de/wiki/uploads';
 ## Sicherheitsfunktionen (Passwörter)
 	$DefaultPasswords['edit'] = '';
 	$DefaultPasswords['admin'] = '<removed>';
 	$DefaultPasswords['attr'] = ' ';
	$DefaultPasswords['upload'] = ' ';
 ?>

As you see here is the same behaviour. (Also with Internet Explorer). Please do not care how IE displays the latter page (!$%#) IE is again using different boundaries (CSS-stuff).

Any ideas? So far I think, I didn't make any mistake, did I?

--Klonk


I didn't realize you had multiple templates within a single skin. That makes all the difference. Simply setting $ActionSkin['print']='lines'; does say to use the skin in pub/skins/lines, but lacking any other information the script will still choose lines.tmpl as the template. If you want the lines skin to do something different when it's being used for printing, you need to place the following in skin.php:

   
   <?php if (!defined('PmWiki')) exit();

   global $action;

   if ($action=='print') 
     LoadPageTemplate($pagename,"$SkinDir/print.tmpl");
   ?>
   

--Pm


This did the trick, thank you very much. Perhaps it is a good idea to put this information as hint or additional point into PmWiki/LayoutAdvanced ?

Thanks again.

BTW: Cool that it is possible to use multiple Layouts in one skin....

BTW2:

 $ActionSkin['print']='test';

has still to stay in config.php. That means a file skin.php is not automatically read (I uploaded the skin.php to the above pages), left ActionSkin under "test" and removed it under "wiki". The print-layout is the same

--Klonk