'Actualités IT Pro', 'Conception' => 'Cycle de vie du logiciel', 'Java' => 'Plateforme et langage Java', '.NET' => 'Microsoft Framework .NET', 'Dév. Web' => 'Développement Web et Webmarketing', 'EDI' => 'Environnements de Développement Intégré', 'Langages' => 'Langages de programmation applicatif', 'SGBD' => 'Systèmes de Gestion de Bases de Données', 'Office' => 'Bureautique pour l\'entreprise', 'Solutions d\'entreprise' => 'Autres logiciels pour l\'entreprise', 'Applications' => 'Applications logicielles', 'Systèmes' => 'Logiciels et matériels systèmes' ); $listeOnglets = mysql_query('SELECT * FROM RUBRIQUE WHERE VISIBLE = 1 ORDER BY ORDRE'); $onglets = array(); while ($ligneOnglet = mysql_fetch_object($listeOnglets)) { $ligneOnglet->tooltip = $tooltips[$ligneOnglet->MENU1]; $SR_result = mysql_query('SELECT ID_RUBRIQUE, URL, LIB, ID_PARENT, IDS_PARENT_SUP, ID_PARENT_AUTRES FROM RUBRIQUE ORDER BY ORDRE'); $sous_rubriques = array(); $sous_rubriques_autres = array(); while ($SR_ligne = mysql_fetch_object($SR_result)) { if ($SR_ligne->ID_PARENT == $ligneOnglet->ID_RUBRIQUE || in_array($ligneOnglet->ID_RUBRIQUE, explode(',', $SR_ligne->IDS_PARENT_SUP))) { $sous_rubriques[] = $SR_ligne; }else if ($SR_ligne->ID_PARENT_AUTRES == $ligneOnglet->ID_RUBRIQUE) { $sous_rubriques_autres[] = $SR_ligne; } } $ligneOnglet->sous_rubrique = $sous_rubriques; $ligneOnglet->sous_rubrique_autres = $sous_rubriques_autres; $onglets[] = $ligneOnglet; } return $onglets; } /** * Objet Smarty (moteur de template). */ $smarty = new Smarty(); $smarty->template_dir = './'; $smarty->compile_dir = './caches'; $onglets = makeMegaRubriques(); $smarty->assign('onglets', $onglets); /** * Affichage des publicités */ $pubOn = isset($_GET['pubOn']) ? $_GET['pubOn'] : 1; /** * On récupère la liste des rubriques de la bdd. */ $listeRubriques = mysql_query('SELECT * FROM RUBRIQUE LEFT OUTER JOIN HiMedia ON RUBRIQUE.ID_RUBRIQUE = HiMedia.RUB_ID ORDER BY ORDRE'); /** * Pour chaque rubrique, on créé un fichier .cache. BOUCLE 1 */ while ($ligneRubrique = mysql_fetch_object($listeRubriques)) { // Publicité $HiMedia = $ligneRubrique->PUB_ID; $smarty->assign('HiMedia', $HiMedia); $smarty->assign('pubOn', $pubOn); $smarty->assign('nom_rubrique', htmlentities($ligneRubrique->LIB)); $ressources = array(); $rubcart = 0; // Dessin des boutons. for ($i = 1; $i <= 16; $i++) { $T = 'RUBT' . $i; $L = 'RUBL' . $i; $txt = $ligneRubrique->$T; $lnk = $ligneRubrique->$L; if (! empty($txt)) { $ressources[] = array('link' => $lnk, 'text' => $txt); $rubcart++; } } $smarty->assign('ressources', $ressources); // Dessin de la barre éventuelle de sous-rubriques $SR_rubriqueParente = 1; $rubrique_active_url = $ligneRubrique->URL; if ($ligneRubrique->ID_PARENT != 0) { $SR_rubriqueActive = $ligneRubrique->ID_RUBRIQUE; $SR_rubriqueParente = $ligneRubrique->ID_PARENT; $SR_rubriqueVisible = $ligneRubrique->VISIBLE; } else { $SR_result = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM RUBRIQUE WHERE ID_PARENT = ' . $ligneRubrique->ID_RUBRIQUE)); if ($SR_result[0] > 0) { $SR_rubriqueActive = $SR_rubriqueParente = $ligneRubrique->ID_RUBRIQUE; $rubrique_active_url = $ligneRubrique->URL; $SR_rubriqueVisible = $ligneRubrique->VISIBLE; } else { $SR_rubriqueActive = 0; } } // Par défaut, la 2eme barre contient des sous-rubriques et non des boutons $smarty->assign('rubrique_has_buttons', '0'); if ($SR_rubriqueActive == 0) { $SR_barre = ''; }else { // On récupère la rubrique parente de la rubrique actuellement sélectionnée $top_parent = mysql_fetch_object(mysql_query('SELECT * FROM RUBRIQUE WHERE ID_RUBRIQUE = ' . $SR_rubriqueParente)); // Si cette rubrique n'a pas elle même de parent, on affiche les sous-rubriques normalement if ($top_parent->ID_PARENT == 0) { $SR_result = mysql_query('SELECT ID_RUBRIQUE, URL, MENU1, ID_PARENT, IDS_PARENT_SUP FROM RUBRIQUE ORDER BY ORDRE'); $topics = array(); while ($SR_ligne = mysql_fetch_object($SR_result)) { if ($SR_ligne->ID_PARENT == $SR_rubriqueParente || in_array($SR_rubriqueParente, explode(',', $SR_ligne->IDS_PARENT_SUP))) { $topics[] = $SR_ligne; } } }else { // Sinon, on affiche les boutons de la rubrique parente $rubcart = 0; $buttons = array(); for ($i = 1; $i <= 16; $i++) { $T = 'RUBT' . $i; $L = 'RUBL' . $i; $R = 'RUBID' . $i; $txt = $top_parent->$T; $lnk = $top_parent->$L; $rubid = $top_parent->$R; if (!empty($txt)) { $buttons[] = array('link' => $lnk, 'text' => $txt, 'rubid' => $rubid); $rubcart++; } } $smarty->assign('buttons', $buttons); $smarty->assign('rubrique_has_buttons', '1'); } } $ongletActif = mysql_fetch_object(mysql_query('SELECT ID_RUBRIQUE, URL, LIB, MENU1 FROM RUBRIQUE WHERE ID_RUBRIQUE = ' . $SR_rubriqueParente)); $rubrique_has_syndic = false; $rubrique_rss = ''; $rubrique_atom = ''; if ($ligneRubrique->RSS != '' && $ligneRubrique->ATOM != '') { $rubrique_has_syndic = true; $rubrique_rss = $ligneRubrique->RSS; $rubrique_atom = $ligneRubrique->ATOM; } $smarty->assign('rubrique_has_syndic', $rubrique_has_syndic); $smarty->assign('rubrique_rss', $rubrique_rss); $smarty->assign('rubrique_atom', $rubrique_atom); $smarty->assign('rubrique_parente', $SR_rubriqueParente); $smarty->assign('rubrique_active', $SR_rubriqueActive); $smarty->assign('rubrique_active_visible', $SR_rubriqueVisible); $smarty->assign('rubrique_active_url', $rubrique_active_url); $smarty->assign('onglet_actif', $ongletActif); $smarty->assign('topics', $topics); $entete = $smarty->fetch('layout-head.tpl'); $entetexhtml = $entete; // Bas de page $titre = htmlspecialchars($ligneRubrique->LIB); $url_forum = $ligneRubrique->URL_FORUM; $resp = $ligneRubrique->RESP; $profil = $ligneRubrique->PROFIL; $coresp = $ligneRubrique->CORESP; $coprofil = $ligneRubrique->COPROFIL; $coresp2 = $ligneRubrique->CORESP2; $coprofil2 = $ligneRubrique->COPROFIL2; $coresp3 = $ligneRubrique->CORESP3; $coprofil3 = $ligneRubrique->COPROFIL3; $profil = htmlentities($profil, ENT_QUOTES); $coprofil = htmlentities($coprofil, ENT_QUOTES); $coprofil2 = htmlentities($coprofil2, ENT_QUOTES); $coprofil3 = htmlentities($coprofil3, ENT_QUOTES); $url_resp = $ligneRubrique->URL_RESP; $smarty->assign('titre_rubrique', $titre); $smarty->assign('url_forum', $url_forum); $smarty->assign('url_resp', $url_resp); $smarty->assign('resp', $resp); $smarty->assign('profil', $profil); $smarty->assign('coprofil', $coprofil); $smarty->assign('coresp', $coresp); $smarty->assign('coresp2', $coresp2); $smarty->assign('coprofil2', $coprofil2); $smarty->assign('coresp3', $coresp3); $smarty->assign('coprofil3', $coprofil3); if ( !isset($url_forum) ) { $lien_forum = "forum d'entraide des développeurs"; } else { $lien_forum = "forum d'entraide $titre"; } $smarty->assign('lien_forum', $lien_forum); // Affichage de l'adresse EMail de la section. if (!empty($url_resp)) { $contactResp = " \n"; $smarty->assign('contactResp', $contactResp); } // Affichage du logo xiti de la section $XitiSite = $ligneRubrique->XITISITE; $NoXiti = $ligneRubrique->XITI; $LogXiti = $ligneRubrique->XITILOG; $smarty->assign('nxiti', $XitiSite); if ($NoXiti > 0) { $xiti = "
\n". "\n". "\n". "\n". "\n". "
\n"; $smarty->assign('xiti', $xiti); } $pied = $smarty->fetch('layout-footer.tpl'); $piedxhtml = $pied; /* * Ecriture des fichiers de cache */ // Cache html $fichierCacheTete = './caches/tete' . $ligneRubrique->ID_RUBRIQUE . '.cache'; $fichierCachePied = './caches/pied' . $ligneRubrique->ID_RUBRIQUE . '.cache'; $fhandle1 = fopen($fichierCacheTete, 'w'); fwrite($fhandle1, $entete); fclose($fhandle1); $fhandle2 = fopen($fichierCachePied, 'w'); fwrite($fhandle2, $pied); fclose($fhandle2); // Cache xhtml $fichierCacheTete = './caches/tetexhtml' . $ligneRubrique->ID_RUBRIQUE . '.cache'; $fichierCachePied = './caches/piedxhtml' . $ligneRubrique->ID_RUBRIQUE . '.cache'; $fhandle1 = fopen($fichierCacheTete, 'w'); fwrite($fhandle1, $entetexhtml); fclose($fhandle1); $fhandle2 = fopen($fichierCachePied, 'w'); fwrite($fhandle2, $piedxhtml); fclose($fhandle2); } echo '

Cache généré.

' . "\n"; echo '

Retour

' . "\n"; ?>