2016-11-17 6 views
0

Wie kann dieser Codeabschnitt obligatorisch/erforderlich gemacht werden? Der Code hat kein einfaches Bild-Upload-Feld. Es ist von einer Joomla-Komponente. Ich habe versucht, das Attribut "erforderlich" wie mit den regulären HTML-Upload-Feldern anzugeben, aber das hat nicht funktioniert.So wird das Hochladen von Bildern erforderlich

<section class="block" id="gallery"> 
       <h2><?php echo JText::_('COM_BT_PROPERTY_GALLERY');?></h2> 
       <div class="center"> 
        <div class="form-group"> 
        <?php 
        if ($this->params->get('fe_upload_type', 1) == 1) { 
         echo $this->loadTemplate('images_flash'); 
        } else { 
         echo $this->loadTemplate('images_simple'); 
        } 
        ?> 
        <?php 
         $params = new JRegistry(); 
         if ($this->item->params) { 
          $params->loadArray($this->item->params); 
         } 
         $thumb_height = $params->get('thumb_height', $this->params->get("thumb_height", 180)); 
         $thumb_width = $params->get('thumb_width', $this->params->get("thumb_width", 336)); 
         if ($thumb_height > 100) { 
          $thumb_width = floor($thumb_width * 100/$thumb_height); 
          $thumb_height = 100; 
         } 
         $thumbimgprocess = $this->params->get('thumbimgprocess', $this->params->get("thumbimgprocess", 1)); 
         ?> 
         <ul id="sortable"> 
         <?php 
          if (is_array($this->images)) { 

           foreach ($this->images as $image) { 
         ?> 
          <li title="Double-click to make default image" 
           <?php if ($image->default) echo 'class="default_image"' ?>><input class="input-default" 
            <?php if ($image->default) echo 'checked="checked"' ?> title="Make default" 
            name="default_image" type="radio" value="<?php echo $image->filename ?>" /> <img 
           class="img-thumb" 
           src="<?php echo JURI::root() . $path . '/' . $this->item->id . '/' . ($this->params->get('thumbimgprocess', 1) == -1 ? 'original' : 'thumb') . '-' . $image->filename; ?>" /> 
           <input type="hidden" name="image_id[]" value="<?php echo $image->id ?>" /> <?php if ($image->youembed != '') { 
                ?> 

           <img class="img_video" src="../components/com_bt_property/assets/img/video.png" /> <?php 
              } 
              ?> 
           <input type="hidden" name="image_filename[]" value="<?php echo $image->filename ?>" /> <br /> 
           <a href="javascript:void(0)" class="edit" onclick="editImage(this)"><?php echo JText::_('COM_BT_PROPERTY_EDIT');?></a> <a 
           href="javascript:void(0)" class="remove" onclick="removeImage(this)"><?php echo JText::_('COM_BT_PROPERTY_REMOVE');?></a> 
          </li> 
          <?php 
           } 
           ?> 
          <input type="hidden" id="property-hidden" name="video" value="<?php echo htmlspecialchars(json_encode($this->images)); ?>" /> 
         <?php 
          } 
          ?> 

         </ul> 
         <a href="#" class="button" onclick="return removeAll()"><?php echo JText::_('COM_BT_PROPERTY_CLEAR_ALL');?></a> 
        </div> 
       </div> 
       <p style = "color:red;"> 
      "Note: files must not contain any form of contact details; names, phone no, email, address, company, website and so on. As designs with such content will not be approved for posting" 
      </p> 
      </section> 

Antwort

0

Ich habe schließlich den Quellcode für die einfache Bildupload-Schaltfläche gefunden, die mit dem obigen Code verknüpft ist. Alles, was ich tun musste, war, wie üblich, vor dem schließenden Datei-Tag (>) anzugeben.

Verwandte Themen