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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 05:01:31 2024 UTC