Jump to content

File Uploader in CMS


Umar Akram

Recommended Posts

 $html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1);

  $this->fields_form = array(
   'tinymce' => true,
   'legend' => array(
    'title' => $this->l('CMS Page'),
    'image' => '../img/admin/tab-categories.gif'
   ),
   'input' => array(
    // custom template
    array(
     'type' => 'select_category',
     'label' => $this->l('CMS Category'),
     'name' => 'id_cms_category',
     'options' => array(
      'html' => $html_categories,
     ),
    ),
    array(
     'type' => 'text',
     'label' => $this->l('Meta title:'),
     'name' => 'meta_title',
     'id' => 'name', // for copy2friendlyUrl compatibility
     'lang' => true,
     'required' => true,
     'class' => 'copy2friendlyUrl',
     'hint' => $this->l('Invalid characters:').' <>;=#{}',
     'size' => 50
    ),
    array(
     'type' => 'text',
     'label' => $this->l('Meta description'),
     'name' => 'meta_description',
     'lang' => true,
     'hint' => $this->l('Invalid characters:').' <>;=#{}',
     'size' => 70
    ),
   
    array(
     'type' => 'tags',
     'label' => $this->l('Meta keywords'),
     'name' => 'meta_keywords',
     'lang' => true,
     'hint' => $this->l('Invalid characters:').' <>;=#{}',
     'size' => 70,
     'desc' => $this->l('To add "tags" click in the field, write something, and then press "Enter."')
    ),
       
       array(
     'type' =>'file',
     'label'=>$this->l('Page Image'),
     'name'=>'pImage',
     'required' => false,
     'display_image' => true
       ),
       
    array(
     'type' => 'text',
     'label' => $this->l('Friendly URL'),
     'name' => 'link_rewrite',
     'required' => true,
     'lang' => true,
     'hint' => $this->l('Only letters and the minus (-) character are allowed')
    ),
    array(
     'type' => 'textarea',
     'label' => $this->l('Page content'),
     'name' => 'content',
     'autoload_rte' => true,
     'lang' => true,
     'rows' => 5,
     'cols' => 40,
     'hint' => $this->l('Invalid characters:').' <>;=#{}'
    ),
    
    array(
     'type' => 'radio',
     'label' => $this->l('Displayed:'),
     'name' => 'active',
     'required' => false,
     'class' => 't',
     'is_bool' => true,
     'values' => array(
      array(
       'id' => 'active_on',
       'value' => 1,
       'label' => $this->l('Enabled')
      ),
      array(
       'id' => 'active_off',
       'value' => 0,
       'label' => $this->l('Disabled')
      )
     ),
    ),
   ),
   'submit' => array(
    'title' => $this->l('Save'),
    'class' => 'button'
   )
  );

 

 

pImage is DATA BASE field name..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...