mhonarc-users

Re: Little MHonArc patch to help with PHP pages....

1998-04-24 09:21:26
[Note, please use the mhonarc list for mhonarc related questions]

On April 23, 1998 at 22:26, Kyle R VanderBeek wrote:

Just one thing.  I've been using php (www.php.net, similar to ASP or
SHTML, but cooler) to make my pages prettier and, unfortunately, it also
uses $ for variables.  The RC parser in MHonArc blows up when I try to
include PHP code fragments that include variables as HTML fragments in my
rc file.  For example, I have a little thing called a "theme" that shows
up on my web pages, and something like this:

<?
include "kylethemes.inc";
$theme = StartPage("Kyle",$HTTP_GET_VARS["theme"]);
?>

is at the top of all my pages.  Your regex for searching for variables
($VarExp = '\$([^\$]*)\$'; in mhinit.pl) produces an error on this line
when it's used somewhere like IdxPgBegin.  Changing it to this

\$([^\$\s]*)\$

Solves the problem, and shouldn't break any existing rc files since they
should be using variables/resources without spaces anyhow.  Just a
thought.

The regex will break an addition I put into the next release and
potential break the use of user defined variables if a user used
a space in a custom variable name.

A solution is to escape the '$' so MHonArc will not think it is the
start of a resource variable.  This is done by doing "$$".  Taking
the example you provided, it can be redone as follows:

<?
include "kylethemes.inc";
$$theme = StartPage("Kyle",$$HTTP_GET_VARS["theme"]);
?>

        --ewh

----
             Earl Hood              | University of California: Irvine
      ehood(_at_)medusa(_dot_)acs(_dot_)uci(_dot_)edu      |      Electronic 
Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Little MHonArc patch to help with PHP pages...., Earl Hood <=