ID: 12477
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Closed
Bug Type: PCRE related
Operating System: Linux and SCO
PHP Version: 4.0.6
New Comment:

Is it possible to ask that the this be included as a new feature?

A switch to tell the PCRE engine? to ignore variable substitution?

It would make things a lot easier, I think.

Thanks

Previous Comments:
------------------------------------------------------------------------

[2001-08-06 12:49:00] [EMAIL PROTECTED]

That's right, you need to escape $ in your replacement strings.

------------------------------------------------------------------------

[2001-07-31 00:40:54] [EMAIL PROTECTED]

The setup for my templating system:

$template=array(
  "/({PAGETOP})/",
  "/({PAGENAVBAR})/",
  "/({PAGEMAIN})/",
  "/({PAGELINKS})/",
  "/({PAGESPACE})/",
  "/({PAGETEXT})/",
  "/({PAGENEWS})/",
  "/({PAGEBOTTOM})/",
  "/({PAGEDATA})/"
  );

$pagevars=array(
  "PAGETOP" => get_page($site->page_top),
  "PAGENAVBAR" => get_page($site->page_top),
  "PAGEMAIN" => get_page($site->page_main),
  "PAGELINKS" => get_page($site->page_links),,
  "PAGESPACE" => get_page($site->page_space),
  "PAGETEXT" => get_page($site->page_text),
  "PAGENEWS" => get_page($site->page_news),,
  "PAGEBOTTOM" => get_page($site->page_bottom),
  "PAGEDATA" => ""
  );

$page = "{PAGETOP}{PAGENAVBAR}{PAGEMAIN}{PAGEBOTTOM}";

$page = preg_replace($template,$pagevars,$page);

echo $page;

Basically each physical page referenced via the get_page function is a text template 
that may contain HTML, text or variables in the form {VAR}.

Eventually content from a database ends up in a variable called PAGEDATA which is in 
the template stored in the page main variable.

The problem:

PAGEDATA ends up containing page text and it has something like "would cost around 
$16,000 to complete" in that text.

When the preg_replace is performed, something somewhere is assuming that $16 is a 
variable (which doesn't exist) and the text ends up as "would cost around ,000 to 
complete"




------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=12477&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to