« Toutes les fonctions avancées
<?php
$ast=new CastBox();
echo $ast->shortdisplay(12,4,0);
?>
• 1er argument : numéro de l'ast (ici la num12)
• 2eme argument : taille de l'image (ici 4 colonnes Bootstrap)
• 3eme argument : un chiffre de 1 à 6, pour différents formats (titre seul, titre+date, titre+debut du texte etc.).
Exemples
<?php
$ast=new CastBox();
$option=array("titre","sstitre","parag1","date","texte");
echo $ast->shortdisplay(12,4,$option);
?>
• 1er argument : numéro de l'ast (ici la num12)
• 2eme argument : taille de l'image (ici 4 colonnes Bootstrap)
• 3eme argument : un tableau avec la liste des champs qu'on veut afficher
<?php
$ast=new CastBox();
echo $ast->visu(12); // affiche l'ast 12
?>
<?php
$num=2862; // numero de l'ast a afficher
$ast=new CastBox();
$infos=$ast->get_ast_info($num);
$g_html->set_title($infos["titre"]); // affiche le titre de l'ast
$g_html->print_header();
echo $ast->visu($num);
$g_html->print_footer();
?>
<?php
$ast=new CastBox();
$arr=$ast->get_der_maj("fait_marquant",2);// les 2 derniers faits marquants
$option=array('date','titre','sstitre','texte'); // champs a afficher
foreach($arr as $id)
{
echo '<div style="margin:5px 2px;padding:0;">';
echo $ast->shortdisplay($id,4,$option);
echo '</div>';
}
?>
• 1er argument : numéro de l'ast (ici la num12)
• 2eme argument : taille de l'image (ici 80px)
• 3eme argument : un tableau avec la liste des champs qu'on veut afficher
<?php
$ast=new CastBox();
$arr=$ast->get_random("ast",1);// 1 ast au hasard
$option=array('date','titre','sstitre','texte'); // champs a afficher
echo $ast->shortdisplay($arr[0],4,$option);
?>
<?php
$ast=new CastBox();
$arr=$ast->get_ast_by_type("projet"); // AST de type projet
$option=array('date','titre','sstitre','texte'); // champs a afficher
foreach($arr as $id)
{
echo '<div style="margin:5px 2px;padding:0;">';
echo $ast->shortdisplay($id,4,$option);
echo '</div>';
}
?>
<?php
$ast=new CastBox();
$arr=$ast->get_der_maj("fait_marquant",2);// les 2 derniers faits marquants
foreach($arr as $id)
{
$data=$ast->get_ast_info_riche($id);
//echo '<pre>';print_r($data);echo '</pre>';
echo '<div>';
echo '<a href="'.$data["href"].'">';
echo '<img src="'.$data["img_href_mr"].'" alt="'.strip_tags($data["titre"]).'" style="box-shadow: 8px 8px 12px #aaa;width:20%;float:left;margin:0 10px 10px 0;" />';
echo '<p style="astshort_date">'.$data["showdate"].'</p>';
echo '<p style="astshort_titre">'.$data["titre"].'</p>';
echo '</a>';
echo '</div>';
echo '<div style="clear:both;"></div>';
}
?>
Mise à jour : 16/03/2015