Пример #1
0
 static function getHTML($articleid, $fieldid, $category = false, $write = false)
 {
     global $globalreturn;
     //$str = fieldattach::getInput($articleid, $fieldid, $category);
     $html = '';
     //if(function_exists( 'fieldattach::getFieldValues' ))
     if (method_exists('fieldattach', 'getFieldValues')) {
         $jsonValues = fieldattach::getFieldValues($articleid, $fieldid, $category);
         $jsonValuesArray = json_decode($jsonValues);
         $valor = html_entity_decode($jsonValuesArray->value);
         $title = $jsonValuesArray->title;
         $published = $jsonValuesArray->published;
         $showTitle = $jsonValuesArray->showtitle;
     } else {
         $valor = fieldattach::getValue($articleid, $fieldid, $category);
         $title = fieldattach::getName($articleid, $fieldid, $category);
         $published = plgfieldsattachment_input::getPublished($fieldid);
         $showTitle = fieldattach::getShowTitle($fieldid);
     }
     if (!empty($valor) && $published) {
         $html = plgfieldsattachment_input::getTemplate($fieldid);
         /*
                         Templating INPUT *****************************
           [TITLE] - Title of field
                         [FIELD_ID] - Field id 
                         [VALUE] - Value of input
         */
         if ($showTitle) {
             $html = str_replace("[TITLE]", $title, $html);
         } else {
             $html = str_replace("[TITLE]", "", $html);
         }
         $html = str_replace("[VALUE]", $valor, $html);
         $html = str_replace("[FIELD_ID]", $fieldid, $html);
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }
Пример #2
0
 function getHTML($articleid, $fieldid, $category = true, $write = false)
 {
     global $globalreturn;
     $db =& JFactory::getDBO();
     $query = 'SELECT positionarticle FROM #__fieldsattach WHERE id = ' . $fieldid;
     $db->setQuery($query);
     $category = $db->loadResult();
     //$str = fieldattach::getInput($articleid, $fieldid, $category);
     $html = '';
     $valor = fieldattach::getValue($articleid, $fieldid, $category);
     $title = fieldattach::getName($articleid, $fieldid, $category);
     $published = plgfieldsattachment_input::getPublished($fieldid);
     if (!empty($valor) && $published) {
         $html = plgfieldsattachment_input::getTemplate($fieldid);
         /*
                         Templating INPUT *****************************
           [TITLE] - Title of field
                         [FIELD_ID] - Field id 
                         [VALUE] - Value of input
         */
         $valor = str_replace(";", "<br />", $valor);
         if (fieldattach::getShowTitle($fieldid)) {
             $html = str_replace("[TITLE]", $title, $html);
         } else {
             $html = str_replace("[TITLE]", "", $html);
         }
         $html = str_replace("[VALUE]", $valor, $html);
         $html = str_replace("[FIELD_ID]", $fieldid, $html);
     }
     //WRITE THE RESULT
     if ($write) {
         echo $html;
     } else {
         $globalreturn = $html;
         return $html;
     }
 }