Example #1
0
function page_news_test()
{
    echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8;'>";
    echo news_date(0);
    echo news_text(0);
    echo news_date(1);
    echo news_text(1);
    echo news_date(3);
    echo news_text(3);
    echo page_news_list();
    die;
}
          <td>&nbsp;</td>
        <?php 
        }
        ?>
        
        <!-- news icon -->
        <td class="icon-id" style="width: 60px;">
          <?php 
        echo image_tag(news_icon_name($generator_model, $generator), array('size' => '44x42', 'absolute' => false));
        ?>
        </td>
        
        <!-- news text -->
        <td>
          <?php 
        echo news_text($n, $generator_model, $pks, $generator, array('context' => CONTEXT_LIST));
        ?>
        </td>
        
      </tr>
      
    <?php 
    }
    ?>
      
  <?php 
}
?>
</table>
  
<div class="section-box-scroller tools-container has-next">
        <?php 
                $date_string = $df->format($date_ts, 'dd') . " " . $df->format($date_ts, 'MMM') . " " . $df->format($date_ts, 'yyyy');
                echo $date_string;
                echo str_repeat('-', strlen($date_string));
                ?>
      <?php 
            } else {
                ?>
NO data
-------
      <?php 
            }
            ?>
    <?php 
        }
        echo html_entity_decode(strip_tags(news_text($n, $generator_model, $pks, $generator, array('in_mail' => true))), ENT_COMPAT, 'UTF-8');
        ?>
:::

  <?php 
    }
    ?>
  
  
<?php 
}
?>

Saluti,
il team Openpolis
 /**
  * torna l'elenco testuale delle news passate in argomento (per feed in formato atom)
  *
  * @param string $news array di oggetti News
  * @return string html
  * @author Guglielmo Celata
  */
 protected function _news_list($news)
 {
     $news_list = '';
     foreach ($news as $n) {
         $news_list .= strip_tags(html_entity_decode(news_text($n, 1), ENT_COMPAT, 'UTF-8')) . "\n";
     }
     return $news_list . "\n\n";
 }
        echo $sf_site_url;
        ?>
/images/<?php 
        echo $icon_img_name;
        ?>
"
               size="44x42" style="border:none; display: block; border: none; background: transparent url(http://<?php 
        echo $sf_site_url;
        ?>
/images/bg-ico-type.png)" />
        </td>
        
        <!-- news text -->
        <td>
          <?php 
        echo news_text($n, $generator_model, $pks, $generator, array('in_mail' => true));
        ?>
        </td>
        
      </tr>
    <?php 
    }
    ?>
      
  <?php 
}
?>
</table>

<?php 
include_partial('monitoring/mailFooter', array('site_url' => $sf_site_url, 'user' => $user, 'msg_type' => 'news'));
            <td>&nbsp;</td>
          <?php 
        }
        ?>
          
          <!-- news icon -->
          <td class="icon-id" style="width: 60px;">
            <?php 
        echo image_tag(news_icon_name($generator_model, $generator), array('size' => '44x42', 'absolute' => false));
        ?>
          </td>
          
          <!-- news text -->
          <td>
            <?php 
        echo news_text($n, $generator_model, $pks, $generator, array('context' => 1));
        ?>
          </td>
          
        </tr>
      <?php 
    }
    ?>
    
  <?php 
}
?>
</table>


/**
 * torna l'elenco ul/li delle news passate in argomento
 *
 * @param string $news array di oggetti News
 * @return string html
 * @author Guglielmo Celata
 */
function news_list($news, $for_mail_or_rss = false, $context = null)
{
    $news_list = '';
    foreach ($news as $n) {
        // fetch del modello e dell'oggetto che ha generato la notizia
        $generator_model = $n->getGeneratorModel();
        if ($n->getGeneratorPrimaryKeys()) {
            $pks = array_values(unserialize($n->getGeneratorPrimaryKeys()));
            $generator = call_user_func_array(array($generator_model . 'Peer', 'retrieveByPK'), $pks);
        } else {
            $pks = array();
            $generator = null;
        }
        $news_list .= content_tag('li', news_text($n, $generator_model, $pks, $generator, array('in_mail' => $for_mail_or_rss, 'context' => is_null($context) ? CONTEXT_LIST : $context)));
    }
    return content_tag('ul', $news_list, array('class' => 'square-bullet'));
}