473,795 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generating forms - XML or PHP?

I need a solution for CMS. I would like to edit and create FORMS
easily, especially list of settings. Which is better and why?

$$ XML or HTML $$
Forms occur in View layer - in presentation file. To simplify editing
forms and to improve readability, webmasters use additional tags and
attributes, e.g. <checkbox>, <radio>, arrayname... The compiler of
templates changes XML code into (X)HTML with conditional expressions
in PHP and variables (until the template class doesn't compile
templates but parse them).

$$ PHP $$
Form fields and their properties are defined in PHP logic code. Form
class generates the HTML form. However, the class needs HTML code of
each <formelement - perhaps from template

Examples: http://code.bulix.org/so4zlh-66117
Jun 2 '08 #1
9 1547
WebCM wrote:
I need a solution for CMS. I would like to edit and create FORMS
easily, especially list of settings. Which is better and why?

$$ XML or HTML $$
Forms occur in View layer - in presentation file. To simplify editing
forms and to improve readability, webmasters use additional tags and
attributes, e.g. <checkbox>, <radio>, arrayname... The compiler of
templates changes XML code into (X)HTML with conditional expressions
in PHP and variables (until the template class doesn't compile
templates but parse them).

$$ PHP $$
Form fields and their properties are defined in PHP logic code. Form
class generates the HTML form. However, the class needs HTML code of
each <formelement - perhaps from template

Examples: http://code.bulix.org/so4zlh-66117
Apples and oranges.

XML and HTML are scripting languages for sharing data. PHP is a
programming language used for processing data. They are two entirely
different things and used for different purposes.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jun 2 '08 #2
You haven't understood me. :) Example of unclear code:

<input type="checkbox" name="name"<!-- IF name -->
checked="checke d"<!-- END --/>

A lot of such constructions make the code unclear. Similar in pure
PHP:

<input type="checkbox" name="name" <?= $name ? 'checked="check ed"' :
'' ?/>

So I'm looking for a good solution for making <form>s. There are 2 or
more methods - XML-based or PHP-based. Which is better and why?

XML-based - example of checkbox:
<checkbox name="name" />

PHP-based:
$form = new Form('...');
$form -set( /*fields, properties, etc. */ );
$template -set('form', $form);
Jun 2 '08 #3
WebCM wrote:
You haven't understood me. :) Example of unclear code:

<input type="checkbox" name="name"<!-- IF name -->
checked="checke d"<!-- END --/>

A lot of such constructions make the code unclear. Similar in pure
PHP:

<input type="checkbox" name="name" <?= $name ? 'checked="check ed"' :
'' ?/>

So I'm looking for a good solution for making <form>s. There are 2 or
more methods - XML-based or PHP-based. Which is better and why?

XML-based - example of checkbox:
<checkbox name="name" />

PHP-based:
$form = new Form('...');
$form -set( /*fields, properties, etc. */ );
$template -set('form', $form);
No, I didn't misunderstand you. However, you're confused about terminology.

There is no such thing as a "php based form". The form can be html or
xml, but not php.

It can be generated by PHP, Perl, ASP or a number of languages.

What you're talking about is not PHP based. It is object oriented
programming. This will generate html or xml statements. But that in
itself is not a form.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jun 2 '08 #4
WebCM wrote:
>You haven't understood me. :) Example of unclear code:

<input type="checkbox" name="name"<!-- IF name -->
checked="check ed"<!-- END --/>

A lot of such constructions make the code unclear. Similar in pure
PHP:

<input type="checkbox" name="name" <?= $name ? 'checked="check ed"' :
'' ?/>

So I'm looking for a good solution for making <form>s. There are 2 or
more methods - XML-based or PHP-based. Which is better and why?

XML-based - example of checkbox:
<checkbox name="name" />

PHP-based:
$form = new Form('...');
$form -set( /*fields, properties, etc. */ );
$template -set('form', $form);

No, I didn't misunderstand you. However, you're confused about
terminology.
There is no such thing as a "php based form". The form can be html or
xml, but not php.

It can be generated by PHP, Perl, ASP or a number of languages.

What you're talking about is not PHP based. It is object oriented
programming. This will generate html or xml statements. But that in
itself is not a form.
But that's not much of an answer; since I think I know where the OP is
coming from and was mildly interested, I read the thread; for nothing it
turns out. Do you ever make any positive posts with actual useful
suggestions? Or ferret out information you need to make a sensible
response?
--

Twayne

Open Office isn't just for wimps anymore;
OOo is a GREAT MS Office replacement
www.openoffice.org

Jun 2 '08 #5
WebCM wrote:
I need a solution for CMS. I would like to edit and create FORMS
easily, especially list of settings. Which is better and why?

$$ XML or HTML $$
Forms occur in View layer - in presentation file. To simplify editing
forms and to improve readability, webmasters use additional tags and
attributes, e.g. <checkbox>, <radio>, arrayname... The compiler of
templates changes XML code into (X)HTML with conditional expressions
in PHP and variables (until the template class doesn't compile
templates but parse them).

$$ PHP $$
Form fields and their properties are defined in PHP logic code. Form
class generates the HTML form. However, the class needs HTML code of
each <formelement - perhaps from template

Examples: http://code.bulix.org/so4zlh-66117
There are solutions like PEAR QuickForm or Zend_Form.
both provide some validation and filtering helpers,
for forms that are often displayed you can use some caching,
to make sure complete model is created only if the form is actually used.

It's also usefull to check phpclasses.org for ideas.

best regards
Piotr Nastaly
Jun 2 '08 #6
On Apr 12, 7:50 am, Piotr <s...@poczta.on et.plwrote:
WebCM wrote:
I need a solution for CMS. I would like to edit and create FORMS
easily, especially list of settings. Which is better and why?
$$ XML or HTML $$
Forms occur in View layer - in presentation file. To simplify editing
forms and to improve readability, webmasters use additional tags and
attributes, e.g. <checkbox>, <radio>, arrayname... The compiler of
templates changes XML code into (X)HTML with conditional expressions
in PHP and variables (until the template class doesn't compile
templates but parse them).
$$ PHP $$
Form fields and their properties are defined in PHP logic code. Form
class generates the HTML form. However, the class needs HTML code of
each <formelement - perhaps from template
Examples:http://code.bulix.org/so4zlh-66117

There are solutions like PEAR QuickForm or Zend_Form.
both provide some validation and filtering helpers,
for forms that are often displayed you can use some caching,
to make sure complete model is created only if the form is actually used.

It's also usefull to check phpclasses.org for ideas.

best regards
Piotr Nastaly
To possibly clearify the question. WebCM, you are unsure whether or
not to dynamically generate a XML for or a HTML form, correct?
So you would like to know which one (Between XML and HTML) is a better
fit for your project?

The easiest thing to do is probably create classes for both. It would
be rather simple. Then you would have options for how many checkboxes,
input fields, or textareas you wanted, and all you would have to do is
arrange your code to fit the output of the form.

Example:
$nf = newForm();
$nf->getInputField( 'User:');
$nf->getInputField( 'Pass:');
$nf->getSubmitField (1);

Or you could have it so
$nf-getInputFields( 1);
$nf-getTextareaFiel ds(1);
$nf-getCheckboxes(5 );

And then just name each one after you get it if you used the second
method.
You could also write one separate for XML.
I'm not an expert at OOP, but I think this might possible be what
you're looking for.
I would suggest research more OOP if you really want to get into it.
A good place to start is http://www.killerphp.com/tutorials/object-oriented-php/
Jun 2 '08 #7
Twayne wrote:
>WebCM wrote:
>>You haven't understood me. :) Example of unclear code:

<input type="checkbox" name="name"<!-- IF name -->
checked="chec ked"<!-- END --/>

A lot of such constructions make the code unclear. Similar in pure
PHP:

<input type="checkbox" name="name" <?= $name ? 'checked="check ed"' :
'' ?/>

So I'm looking for a good solution for making <form>s. There are 2 or
more methods - XML-based or PHP-based. Which is better and why?

XML-based - example of checkbox:
<checkbox name="name" />

PHP-based:
$form = new Form('...');
$form -set( /*fields, properties, etc. */ );
$template -set('form', $form);
No, I didn't misunderstand you. However, you're confused about
terminology.
There is no such thing as a "php based form". The form can be html or
xml, but not php.

It can be generated by PHP, Perl, ASP or a number of languages.

What you're talking about is not PHP based. It is object oriented
programming. This will generate html or xml statements. But that in
itself is not a form.

But that's not much of an answer; since I think I know where the OP is
coming from and was mildly interested, I read the thread; for nothing it
turns out. Do you ever make any positive posts with actual useful
suggestions? Or ferret out information you need to make a sensible
response?
Yep. And this was helpful. Maybe it isn't what he wants, but before he
can ask what he needs to know, he needs to understand the differences
between html, xml and PHP.

You should learn something about what you're talking about before you
start criticizing those who know more than you.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jun 2 '08 #8
Hello,

on 04/12/2008 04:50 AM WebCM said the following:
I need a solution for CMS. I would like to edit and create FORMS
easily, especially list of settings. Which is better and why?

$$ XML or HTML $$
Forms occur in View layer - in presentation file. To simplify editing
forms and to improve readability, webmasters use additional tags and
attributes, e.g. <checkbox>, <radio>, arrayname... The compiler of
templates changes XML code into (X)HTML with conditional expressions
in PHP and variables (until the template class doesn't compile
templates but parse them).

$$ PHP $$
Form fields and their properties are defined in PHP logic code. Form
class generates the HTML form. However, the class needs HTML code of
each <formelement - perhaps from template

Examples: http://code.bulix.org/so4zlh-66117
If you define forms as HTML or XML you are mixing application logic with
presentation logic.

A better approach is to define and process forms only as application
logic, and then have a component to generate forms HTML from the forms
definition, eventually using PHP embedded in HTML, Smarty or other type
of templates to define presentation logic.

You can achieve that with this forms generation and validation class.

http://www.phpclasses.org/formsgeneration
--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Jun 2 '08 #9
Manuel Lemos wrote:
Hello,

on 04/12/2008 04:50 AM WebCM said the following:
>I need a solution for CMS. I would like to edit and create FORMS
easily, especially list of settings. Which is better and why?

$$ XML or HTML $$
Forms occur in View layer - in presentation file. To simplify editing
forms and to improve readability, webmasters use additional tags and
attributes, e.g. <checkbox>, <radio>, arrayname... The compiler of
templates changes XML code into (X)HTML with conditional expressions
in PHP and variables (until the template class doesn't compile
templates but parse them).

$$ PHP $$
Form fields and their properties are defined in PHP logic code. Form
class generates the HTML form. However, the class needs HTML code of
each <formelement - perhaps from template

Examples: http://code.bulix.org/so4zlh-66117

If you define forms as HTML or XML you are mixing application logic with
presentation logic.
Yes, that's true. But then again, that's what PHP is excellent at.
A better approach is to define and process forms only as application
logic, and then have a component to generate forms HTML from the forms
definition, eventually using PHP embedded in HTML, Smarty or other type
of templates to define presentation logic.
Not necessarily. It depends on what you need done. And PHP embedded in
HTML is often NOT the best way to do something.
You can achieve that with this forms generation and validation class.

http://www.phpclasses.org/formsgeneration

Spamming your crappy classes again? You should at least warn people
that these are your classes, and therefore your opinion is far from
unbiased.

But you never have done that. It is the only way you can get someone to
your your junk?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jun 2 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
2140
by: flupke | last post by:
Hi, i create my GUIs mainly via wxGlade. However when you start of to program and want to do some rearranging to the gui, wxglade overwrites your file and you've got to put your own code back in. I think i can work around that (at least a bit) by making a second file that imports the gui generated by wxglade and make classes that extend the original ones. For instance i could have a class MainForm that extends the wxFrame
7
3586
by: Venus | last post by:
Hello, I am trying to generate a dynamic form at runtime and would like to do it using "<asp: ..." form elements as follows Build up the string that is placed somewhere in the HTML code the same way like regular input fields can. strForm = "<form name=""myForm"" runat=""server"">" & vbCrLf strForm += "<asp:button name=""myName"" .... runat=""server"" />" & vbCrLf
0
1447
by: Raghavendra | last post by:
hi, we r using forms authetication. problem :- i am using the below code to generate excel report but since we r using forms authetication.. after generating excel report the browser directs to login.apsx which is specified in web.config file. this code is in one file.aspx
4
1388
by: Bill J | last post by:
Hi Everyone, Is there a way of generating a keyboard character event and sending it to a control on a form? For example, if I have a menu item called "Delete", I would like to send a DEL character event to the currently active control on the form. Thanks.
0
2034
by: utkarsh | last post by:
Hi All, I have a DLL contains two classes, first one which is to be serialized and other one is a UserControl class have code to serialize as below:- class XYZ: System.Windows.Forms.UserControl { public XYZ() {
2
4266
by: mats_trash | last post by:
I've been doing some fairly extensive searching on this topic and have not yet found a solution that doesn't involve recoding the schema in some framework-specific xml and jumping through various other hoops. Is there not some web-2.0-framework-publishing-(non)-bells-and-whistles-technology that will take a valid XML Schema and create either an XForm or standard HTML form, publish it, and then validate the subsquent data submission...
1
1581
by: sparks | last post by:
we are generating numbers for the data collection people. this worked fine for a while.. Private Sub generatenumber() Dim db As DAO.Database Dim rs As DAO.Recordset Dim StudentNumber As Integer Dim gennum As Integer Dim finalnum As Integer
20
3108
by: Constantine AI | last post by:
Hi I have this code which i thought was perfect maybe a bit of a mess but it works. The only problem is that the rst!PONo does not look at the table properly and generate a continuing number, which i fine but i would prefer it to fill in the blanks plus carryon from the last record in the table. Also the last problem is that assigning this PONo to relevant records within a loop procedures works sometimes and then doesn't. Here is the code: ...
1
2207
nine72
by: nine72 | last post by:
Ok, I am at a complete loss on this and have finally come to the XML Parsing Gods (and perhaps a PHP minor deity) for guidance… I will try my best to describe what I have going on… 1) I have 15 form pages, well over 500 potential fields, which are written in PHP. While most pages are one time entry forms, there are 5 that can be “recycled” as many times as needed. An example would be the Contacts Form. A user can give me 1 contact and move...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.