Jump to content

WebCM

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

WebCM's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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 <form> element - perhaps from template Examples: http://code.bulix.org/so4zlh-66117 Example of unclear code: <input type="checkbox" name="name"<!-- IF name --> checked="checked"<!-- END --> /> A lot of such constructions make the code unclear. Similar in pure PHP: <input type="checkbox" name="name" <?= $name ? 'checked="checked"' : '' ?> /> 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, etc. */); $template -> set('form', $form);
  2. I'm making some changes in poll module. I don't know which method of storing options of poll is better. The main data of polls are in POLLS table. Speed and efficiency is the most important issue. There are 2 methods: 1. Storing options in ANSWERS table and executing 2 queries to get poll's data and options. Number of records connected with a poll in that table is equal to number of poll's options. Fields in ANSWERS table: Poll ID | Sequence (optional) | Option | Amount of votes 2. Storing options in another field in POLLS table. They would be being unserialized after getting data from database. Perhaps, it's faster method. Tests of serialize() and unserialize(): Seconds: 0.000138 | 9.5E-005 Miliseconds: 0.122 | 0.095 What do you think about it? Which method should I use?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.