<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote
 cite="midmailman.134.1150387303.26060.pmwiki-users@pmichaud.com"
 type="cite">
  <pre wrap="">From: "Patrick R. Michaud" <a class="moz-txt-link-rfc2396E" href="mailto:pmichaud@pobox.com">&lt;pmichaud@pobox.com&gt;</a>
Subject: Re: [pmwiki-users] Problem wih Include Directives
  </pre>
  <blockquote type="cite">
    <pre wrap="">I have a problem with the include directive, including when it is 
used in a PageList template: When including a page, the variable $Name 
is the one of the page doing the include instead of the page being 
included. 
    </pre>
  </blockquote>
  <pre wrap=""><!---->
This has been a long-standing issue within PmWiki; {$Name} always
refers to the page being browsed, and never to the name of an
included page.

Oh, wait!  After thinking about it a bit I think I may have
a reasonable answer.  I just need a good page variable marker
that means "included page" as opposed to "current page",
similar to how {=$Name} is different from {$Name} in pagelist
templates.
  </pre>
</blockquote>
THe problem is that sometimes, the include as it is working now, is
what I really want. I use it these days to include a MySQL query (using
a modified recipe) included in a template and changing its parameters
using the page name. It works absolutely beautifully.<br>
<br>
What I tried to do was to include another parameter in the include
markup so that this parameter would trigger a parsing of the string
recovered from the input file before being included, that parsing
concerning only varible names like $Name. The advantage would be that
this parameter can then be used in a template for pagelist (and taht
worked too).<br>
<br>
Unfortunately, the code of the include directive is a bit dense for me,
and I did not succeed in what I tried, but surely, if the idea is OK
with you, you can do this.<br>
<br>
I therefore changed my approach and created the following markup, which
works quite nicely:<br>
<br>
Markup('frameHTML','&lt;links', '/\\(:frameHTML(\\s.*?)?:\\)/e',
"Keep(FrameHTML('$1'))");<br>
<br>
function FrameHTML($attr) {<br>
&nbsp;&nbsp;&nbsp; $el = explode(" ", $attr);<br>
<br>
&nbsp;&nbsp;&nbsp; if (isset($el[1]))<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $width = ' width="'.$el[1].'"';<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $width = '';<br>
<br>
&nbsp;&nbsp;&nbsp; if (isset($el[2]))<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $height = ' height="'.$el[2].'"';<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $height = '';<br>
&nbsp;&nbsp;&nbsp; return '&lt;iframe name="I"'.$width.$height.'
src="'.substr($el[3],4).'"&gt;&lt;/iframe&gt;';<br>
}<br>
<br>
I know, it is probably not very nice code, but it is effective enough
to include other pages in a frame.<br>
<br>
Philippe<br>
</body>
</html>