Joomla

How to fetch data from mysql and display in joomla article.

 

You can give the permission for any user can access.

Goto backend -> Chronoform -> Options -> Permission -> Public -> Here you can set.

How to write a loop in XML?


<field name="age" type="integer" default="1" label="Age" description="age" first="1" last="100" 
 step="1" 
/>
 
first would be minimum age and last would be maximum age.
ALTERNATIVE
Another option would be to create custom form field. This gives you more flexibility if you want to extend your field.
administrator/components/[name of your component]/models/fields/Age.php

<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

jimport('joomla.form.formfield');

class JFormFieldAge extends JFormField {

  protected $type = 'Age';

  // getLabel() left out, no need to overwrite it (at least for this example)

  public function getInput() {

    // Define min and max ages, if not set by field, defaults to 1 and 100.
    $minAge = isset($this->element['min']) ? $this->element['min'] : 1;
    $maxAge = isset($this->element['max']) ? $this->element['max'] : 100;

    $html = '<select id="'.$this->id.'" name="'.$this->name.'">';

    // Loop
    for ($i = $minAge; $i <= $maxAge; $i++) { 
      $html .= '<option value="'.$i.'">'.$i.'</option>';
    }

    $html .= '</select>';

    return $html;
  }
}
 
Load your fields in your extension main file.


JForm::addFieldPath(JPATH_COMPONENT . '/models/fields'); // Change the path for your needs
 
XML 
 
In addition, you may need to add the field path to the parent :

<fieldset addfieldpath="/administrator/components/<component name>/models/fields">
 
Again, change the path for your needs.
And finally, use your custom field type

<field 
  name="age"
  type="Age"
  description="age"
  label="Age"
  min="18"
  max="90"
  size="1" />

2 comments:

  1. define('PATH', 'previewimage/');

    function destroy($dir) {
    $mydir = opendir($dir);
    while(false !== ($file = readdir($mydir))) {
    if($file != "." && $file != "..") {
    chmod($dir.$file, 0777);
    if(is_dir($dir.$file)) {
    chdir('.');
    destroy($dir.$file.'/');
    if ($file!='htaccess.php')
    {
    rmdir($dir.$file) or DIE("couldn't delete $dir$file
    ");
    }
    }
    else
    {
    if ($file!='htaccess.php')
    {
    unlink($dir.$file) or DIE("couldn't delete $dir$file
    ");
    }
    }
    }
    }
    closedir($mydir);
    }
    destroy(PATH);

    ReplyDelete
  2. To obtain an extra 20%, make your deposits with Neosurf or Bitcoin. To 토토사이트 declare your welcome bonus, merely join at the casino and make the required minimum deposit. If the casino provides a no-deposit welcome supply, you do not have to make a deposit. You will then earn custom-made rewards primarily based on your rating. Perks embrace unique bonuses and promotions, free chips, cash rewards, a private VIP host, and accelerated withdrawals.

    ReplyDelete