php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49380 HTML macros
Submitted: 2009-08-27 02:08 UTC Modified: 2010-12-29 17:44 UTC
Votes:2
Avg. Score:2.5 ± 1.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: tcjohans at riseup dot net Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.3.0 OS: Windows Vista
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tcjohans at riseup dot net
New email:
PHP Version: OS:

 

 [2009-08-27 02:08 UTC] tcjohans at riseup dot net
Description:
------------
I propose the ability to create "macros" that can be used in the HTML (outside of the PHP start and end tags, <?php and ?>).

This will facilitate using PHP in systems oriented to web site builders who lack knowledge of PHP, but need to use certain interactive features.

The below example creates a macro USERNAME which can be inserted into HTML to reflect the current site user's name.
However, macros could perhaps also be used to create forms, e.g. by defining a macro "FORM". 
Also, if macros could be defined so as to take arguments, they would be even more powerful.

Reproduce code:
---------------
<?php

global $USERNAME;
$USERNAME = "John";

macro USERNAME {
  global $USERNAME;
  echo $USERNAME;
}

?>

Hello!<br>
Your name is USERNAME.<br>
Bye!

Expected result:
----------------
Hello!
Your name is John.
Bye!


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 13:08 UTC] jani@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2010-12-29 13:08 UTC] jani@php.net
Please refer to internals list for several discussions on macros.
 [2010-12-29 17:44 UTC] tcjohans at riseup dot net
Why do you tell me this? Either you are interested in implementing and you implement or you don't. Why would I need an obscure reference to some obscure discussion in some obscure place?
 [2010-12-29 17:47 UTC] tcjohans at riseup dot net
I have submitted several very good suggestions for development of PHP, but each time I just receive these extremely defensive replies back; I am giving up.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 05:01:34 2025 UTC