Blog du grouik - Mot-clé - dotclearLe blog du grouik. Memos d'un Admin sys linux windows, logiciels libres, imprimante 3D2024-01-16T12:12:27+00:00Gniearkurn:md5:87c2396a7331cd5cd18f8751d216ec7bDotclearEnvironnement de dev hors ligneurn:md5:febe7514c20ece2fd5d2ef6fb7b371ce2017-07-17T09:26:00+02:002017-07-17T16:08:12+02:00gniearkServeurs http web et autresApachedotclearserveur <p><img src="https://blog-du-grouik.tinad.fr/public/.IMG_20170614_071154_m.jpg" alt="IMG_20170614_071154.jpg" style="display:table; margin:0 auto;" title="IMG_20170614_071154.jpg, juil. 2017" /></p>
<p>::TOC::</p>
<p>Navetteur SNCF depuis plus d'un an, mes méthodes de développement des projets personnel se sont adaptées.</p>
<p>La 3G/4G partagée avec mon PC portable dans le train n'est suffisamment stable ni pour faire du dev sur un serveur distant ni des actions d'administration système linux (même via mosh). <sup>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#wiki-footnote-1" id="rev-wiki-footnote-1">1</a>]</sup></p>
<p>Je fais mumuse en quasi local et push de temps en temps.</p>
<p>Vous avez donc compris l'objectif de ce tutoriel: Installer sur mon PC portable un serveur web local et la documentation hors ligne des langages que j'utilise. Plus en détail:</p>
<ul>
<li>Serveur web apache pour simplifier</li>
<li>PHP 7 + mysql</li>
<li>Le serveur web fonctionne avec le même user que moi, C'est un serveur de dev. Je veux me simplifier la gestion des droits sur les fichiers. Et d'ailleurs, les répertoires servant de racine aux vitrualhosts se trouvent dans mon dossier user. Comme ça, j'y vais directement avec mon éditeur préféré<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#wiki-footnote-2" id="rev-wiki-footnote-2">2</a>]</sup>.</li>
<li>J'ai plusieurs projets en cours. Plusieurs VHOSTS locaux</li>
<li>La documentation hors ligne et SWAGGER editor.</li>
</ul>
<p>/!\ J'évoque bien un environnement de dev, limité à mon ordinateur portable. Pour un serveur web en production, certains points décrits ici sont à ne surtout pas faire! Si je devais faire un environnement de production, comme le serveur hébergeant ce blog, ce serait NGINX + PHP7-FPM.<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#wiki-footnote-3" id="rev-wiki-footnote-3">3</a>]</sup></p>
<h2>Environnement</h2>
<p>Ubuntu 17.04, mais ce qui va suivre fonctionnera (en adaptant un chouilla) sur d'autres distributions.</p>
<p>Évidemment, dans la suite, lorsque j'utilise l'user "gnieark" ou le chemin "/home/gnieark/....", Vous adaptez avec votre user unix hein!</p>
<h2>Installer LAMP</h2>
<h3>La base</h3>
<pre class="brush: bash">sudo apt-get install apache2 php mysql-server libapache2-mod-php php-mysql git</pre>
<h3>Les modules</h3>
<p>Accessoirement, pour mes besoins, j'ai installé:</p>
<pre class="brush: bash">sudo apt-get install php-curl php-mbstring php-zip php7.0-xml
#activer le mod rewrite
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart</pre>
<h3>Configuration</h3>
<h4>Arborescence / résolution de noms</h4>
<p>Je vais créer 4 vhosts pour le moment<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#wiki-footnote-4" id="rev-wiki-footnote-4">4</a>]</sup></p>
<p>Créer les répertoires (les actions suivantes sont faites en tant que "gnieark", pas en tant que root)</p>
<pre class="brush: bash">cd ~
mkdir www
cd www
mkdir default
mkdir dotclear
mkdir swagger
mkdir botsarena
#au passage on s'installe si on veut phpmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.7.2/phpMyAdmin-4.7.2-all-languages.zip
unzip phpMyAdmin-4.7.2-all-languages.zip
mv phpMyAdmin-4.7.2-all-languages phpmyadmin
#Installer swagger (Ne le faites pas si vous n'en avez pas l'utilité)
git clone https://github.com/swagger-api/swagger-editor.git swagger
#mettre des fichiers qui permettront de vérifier que ça marche
echo "dotclear" > dotclear/index.html
echo "botsarena">botsarena/index.html
touch default>index.html</pre>
<ul>
<li>dotclear parcequ'en ce moment je fais mumuse à developper un <a href="https://bitbucket.org/gnieark/dc-rest-api">plugin pour dotclear</a></li>
<li>Swagger pour héberger localement Swagger editor qui me sert pour le projet précédent</li>
<li>botsarena pour le fun</li>
</ul>
<p>Afin que ça marche, je veux que les noms de domaines suivants:</p>
<ul>
<li>dotclear.localhost</li>
<li>swagger.localhost</li>
<li>botsarena.localhost</li>
<li>phpmyadmin.localhost</li>
</ul>
<p>soient résolus par mon PC en leur attribuant l'adresse IP locale 127.0.0.1</p>
<p>Dans ce but, je modifie la première ligne de mon fichier<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#wiki-footnote-5" id="rev-wiki-footnote-5">5</a>]</sup> /etc/hosts comme ceci:</p>
<pre>
127.0.0.1 localhost dotclear.localhost swagger.localhost botsarena.localhost phpmyadmin.localhost
</pre>
<h4>changer l'user apache</h4>
<p>Éditez le fichier /etc/apache2/envvars</p>
<p>Commentez les lignes définissant l'user et le group et remettez les avec votre user. Comme ceci.</p>
<pre>
#export APACHE_RUN_USER=www-data
#export APACHE_RUN_GROUP=www-data
export APACHE_RUN_USER=gnieark
export APACHE_RUN_GROUP=gnieark
</pre>
<h4>/etc/apache2/apache2.conf</h4>
<p>Dans le fichier /etc/apache2/apache2.conf</p>
<p>Trouvez le bloc</p>
<pre class="brush: xml"><Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory></pre>
<p>On va y changer le chemin et la valeur AllowOverride afin d'autoriser les .htaccess comme ceci:</p>
<pre class="brush: xml"><Directory /home/gnieark/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory></pre>
<h4>Créer différents Vhosts</h4>
<p>Je remplace tout le fichier /etc/apache2/sites-available/000-default.conf par celui ci dessous qui contient la configuration minimaliste de chaque vhost.</p>
<pre class="brush: xml"><VirtualHost *:80>
#default vhost
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /home/gnieark/www/default
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName dotclear.localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/gnieark/www/dotclear
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName botsarena.localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/gnieark/www/botsarena
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName swagger.localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/gnieark/www/swagger
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName phpmyadmin.localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/gnieark/www/phpmyadmin
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost></pre>
<p>Appliquer les changements:</p>
<pre class="brush: bash">sudo /etc/init.d/apache2 restart</pre>
<p>Je vérifie que ça marche en me rendant sur</p>
<pre>
http://dotclear.localhost/
</pre>
<p>et les autres sites locaux définis.</p>
<p>C'est OK.</p>
<p><img src="https://blog-du-grouik.tinad.fr/public/.Capture_du_2017-07-16_21-49-47_m.png" alt="Capture_du_2017-07-16_21-49-47.png" style="display:table; margin:0 auto;" title="Capture_du_2017-07-16_21-49-47.png, juil. 2017" /></p>
<p>Voilà, à ce niveau, j'ai mon environnement de dev, avec un documentRoot inclus dans mon répertoire home et un serveur web qui utilise mon uid unix. Ca va me faciliter les "git clone", "git push" et autres.</p>
<h2>Documentation hors ligne</h2>
<p>La meilleure solution que j'ai trouvée est le service <a href="http://devdocs.io/">devdoc.io</a>. Il permet un mode hors ligne.</p>
<h2>Installer Dotclear</h2>
<p>Ce n'est pas l'objet de ce tuto en fait, mais tant que j'y suis:</p>
<p>Préparer une base de données:</p>
<pre class="brush: bash">mysql -u root -p</pre>
<p>Puis dans le prompt mysql:</p>
<pre class="brush: sql">CREATE DATABASE dotclear;
GRANT ALL ON dotclear.* TO 'dotclear'@'localhost' IDENTIFIED BY 'dcpwd';</pre>
<pre class="brush: bash">cd /home/gnieark/www/dotclear
rm *
wget https://download.dotclear.org/loader/dotclear-loader.php</pre>
<p>Créer le fichier /home/gnieark/www/dotclear/.htaccess suivant:</p>
<pre>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1
RewriteRule ^index.php$ index.php/
</pre>
<p>RDV avec un navigateur à l'URL http://dotclear.localhost et suivre les indications</p>
<p>Une fois Dotclear installé, dans les parametres avancés du blog, changez la l'Url du blog par: http://dotclear.localhost/ et la méthode de lecture des URL par "PATH_INFO".</p>
<div class="footnotes"><h4>Notes</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#rev-wiki-footnote-1" id="wiki-footnote-1">1</a>] J'ai pendant un moment remis en cause la qualité de freeMobile sur ce point, mais je me suis aperçu qu'avec une clef Orange, c'était la même non qualité de service sur la ligne Rouen Paris</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#rev-wiki-footnote-2" id="wiki-footnote-2">2</a>] kate</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#rev-wiki-footnote-3" id="wiki-footnote-3">3</a>] Nginx / Apache même combat, mais le mode de paramétrage du premier force à être plus fin et rigoureux. Par exemple, on va vraiment définir uniquement (via des regex) quels sont les seuls fichiers php qui pourront être interprétés. De plus, je n'installe pas PHPmyAdmin en prod</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#rev-wiki-footnote-4" id="wiki-footnote-4">4</a>] Le vhost default n'est pas compté</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2017/07/16/Environnement-de-dev-hors-ligne#rev-wiki-footnote-5" id="wiki-footnote-5">5</a>] Il n'est pas possible d'utiliser de wildcard dans le fichier hosts. Et je ne souhaite pas ajouter un résolveur local dans ce but.</p></div>
Petit correctif sur le plugin Piwik de Dotclearurn:md5:700b54239ce384be90dacbe16179f6ce2017-04-04T18:59:00+02:002017-04-05T07:14:43+02:00gniearkdev webdotclear <p><img src="https://blog-du-grouik.tinad.fr/public/.piwik-graph_m.png" alt="piwik-graph.png" style="display:table; margin:0 auto;" title="piwik-graph.png, avr. 2017" /></p>
<p>Sur plusieurs des blogs que j'administre, j'ai choisi de modifier le plugin Piwik.</p>
<p>Sauf erreur de ma part, le trackerPiwik JavaScript proposé par Piwik a du être modifié depuis la création du plugin.</p>
<p>A présent il se met dans le HEAD de la page et est asynchrone (La requête vers Piwik sera exécutée une fois que la page est entièrement chargée).</p>
<p>Les outils d'optimisation de sites web apprécient cet aspect.</p>
<p>Voici le .zip du plugin modifié par mes soins. <a href="https://blog-du-grouik.tinad.fr/public/piwik.zip">piwik.zip</a></p>Dotclear, ajouter une table des matières dans un billeturn:md5:af92b3a68ede6b5ae63debbd5ee55fb82012-06-28T21:57:00+02:002017-04-07T09:08:43+02:00gniearkdev webdotclearjavascriptTutoriel-mémo <p>::TOC::</p>
<h2>Edit:</h2>
<p>Je rajoute (et recommande) une première méthode, le plugin multitoc qui m'a été signalée dans les commentaires et qui a l'avantage de ne pas faire passer un code javascript qui parcourt la page. (plus propre).</p>
<h2>La méthode du plugin multitoc</h2>
<h3>Installez les pluggins</h3>
<p><a href="http://plugins.dotaddict.org/dc2/details/multiToc" hreflang="fr">multitoc</a> et <a href="http://plugins.dotaddict.org/dc2/details/stacker">stackers</a></p>
<p>L'extension "Table des matières" apparait dans le bandeau de gauche de l'administration de dotclear.</p>
<p>Allez y pour activer les tables des matières sur les billets.</p>
<h3>Dans le CSS j'ai ajouté:</h3>
<pre class="brush: css">.post-toc {
background-color: #FFFFFF;
border: 1px solid #8CACBB;
padding: 0.5em 0 0.7em;
text-align: left;
color: #1D2B4F;
margin-bottom: 10px;
clear: both;
float: right;
font-size: 80%;
margin: 1.2em 0 0 2em;
width: 200px;
z-index: 10;
}
.post-toc a{color: #1D2B4F;}
.post-toc ul{padding: 2px; margin:10px;}
.post-toc ul li{padding-bottom: 4px;}</pre>
<p>pour personnaliser la table des matières.</p>
<h3>Dans l'interface de rédaction d'un billet</h3>
<p>L'icone
<img src="https://blog-du-grouik.tinad.fr/public/bt_multitoc.png" alt="bt_multitoc.png" title="bt_multitoc.png, juil. 2012" />
permet d'ajouter le sommaire.</p>
<h2>Méthode JavaScript</h2>
<p>Je vais vous expliquer la technique que j'ai utilisée pour mettre une table des matières dans ce billet. Celle-ci reprend automatiquement les titres; marqués par des !!!! dans le mode wiki, puis des balises <h1> <h2> etc....</p>
<p>Techniquement la solution est moche<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2012/06/28/Dotclear%2C-ajouter-une-table-des-mati%C3%A8res-dans-un-billet#wiki-footnote-1" id="rev-wiki-footnote-1">1</a>]</sup>: c'est un code javascript qui crée le sommaire de toute pièce.</p>
<h3>Descriptif de la méthode.</h3>
<p>Rendons à Cesar ce qui appartient à César, je n'ai pas fait grand chose.
J'utilise le plugin MyMeta codé par un ami de tous les dotcleariens <a href="http://plugins.dotaddict.org/dc2/details/mymeta">MyMeta sur dottatict</a> -- Bruno Hondelatte et je me suis basé sur le javascript et l'explication donnée par <a href="http://fr.blog.thomasmuguet.info/index.php?post/2011/07/31/Generer-une-table-des-matieres-dans-les-billets-dotclear">Thomas Muguet sur son blog</a> (l'art de modifier un truc que je n'aurai pas été capable de faire)</p>
<p>Mymeta sert à identifier les billet qui auront un sommaire (je le mettrai sur ceux qui sont assez longs). pour ces billets, on met une sorte de marqueur dans son qui permettra au script ajouté sur le site d'insérer la table des matières uniquement dans ce billet.</p>
<p>Cette dernière se repose sur les principe des ancres HTML</p>
<h3>MyMeta pour repérer les billets qui auront un sommaire:</h3>
<p>Installez sur le sur votre blog, <a href="http://plugins.dotaddict.org/dc2/details/mymeta">MyMeta sur dottatict</a></p>
<p>Puis creez un méta de type case à cocher, comme ça:</p>
<p><img src="https://blog-du-grouik.tinad.fr/public/.mymeta-sommaire_m.jpg" alt="mymeta-sommaire.jpeg" style="display:table; margin:0 auto;" title="mymeta-sommaire.jpeg, juin 2012" /></p>
<p>Pensez à activer le méta.</p>
<p>Maintenant, dans l'interface de rédaction d'un billet, j'ai une case à cocher "sommaire" en bas.</p>
<p><img src="https://blog-du-grouik.tinad.fr/public/.mymeta-sommaire1_m.jpg" alt="mymeta-sommaire1.jpeg" style="display:table; margin:0 auto;" title="mymeta-sommaire1.jpeg, juin 2012" /></p>
<p>(inception inside)</p>
<p>On a vu comment différencier les billets à sommariser et maintenant, une nouvelle partie à ce billet (et donc un nouveau element de mon sommaire):</p>
<h3>Adapter le template:</h3>
<h4>Au niveau d'un billet (post)</h4>
<p>Dans le contenu d'un billet, dans la div class="post-content", (et au début de celle-ci); s'il y a un sommaire il faut qu'il y ait la div avec l'id toc.</p>
<pre class="brush: html"><tpl:MyMetaIf type="sommaire" value="1">
<div class="toc">
<h2>Table des matières:</h2>
</div>
</tpl:MyMetaIf></pre>
<p>en fait, le j'ai mis ainsi (seulement pour les billets qui sont entièrement affichés):</p>
<pre class="brush: html"><!-- # Entry without excerpt -->
<tpl:EntryIf extended="0">
<div class="post-content"><tpl:MyMetaIf type="sommaire" value="1"><div class="toc"><h2>Table des matières:</h2></div></tpl:MyMetaIf>{{tpl:EntryContent}}</div>
</tpl:EntryIf></pre>
<p>C'est à faire dans tous les fichiers de template qui donnent le contenu d'un billet (avec le jeu des include, je n'en ai qu'un pour le template de ce blog)</p>
<h4>Ajouter le script javascript</h4>
<p>dans le fichier _head.html de votre template, ajoutez:</p>
<pre>
<script type="text/javascript" src="{{tpl:BlogThemeURL}}/tableDesMatieres2.js"></script>
</pre>
<p>et déposez le fichier <a href="https://blog-du-grouik.tinad.fr/themes/aorakit-2D/tableDesMatieres2.js">http://blog-du-grouik.tinad.fr/themes/aorakit-2D/tableDesMatieres2.js</a> à la racine du thème de votre blog.</p>
<p>Comme indiqué en intro, il s'agit d'une adaptation du code de <a href="http://fr.blog.thomasmuguet.info/index.php?post/2011/07/31/Generer-une-table-des-matieres-dans-les-billets-dotclear">thomasmuguet.info</a></p>
<p>Il contient ça (des fois que je venais à le déplacer en oubliant d'éditer ce billet):</p>
<pre class="brush: javascript">/*
* Script modifié de façon mineure par Gnieark http://blog-du-grouik.tinad.fr juin 2012
* (place le sommaire dans le post-content afin de mieux pouvoir le gérer en CSS)
* Sépare les ancres des titres (juste avant, c'est plus joli)
*
* Script initial par Thomas Muguet:
* http://fr.blog.thomasmuguet.info/index.php?post/2011/07/31/Generer-une-table-des-matieres-dans-les-billets-dotclear
*
*/
// Unique ID for each element in TOC
var uid=0;
// Generate the TOC from an element, at a certain depth
function getTOCLevel(from, level) {
var content = '';
// Depending on the depth, detect where to stop traversing the DOM
var to = (level == 2) ? ".post-content" : "h2";
if (level > 3) {to += " h3";}
if (level > 4) {to += " h4";}
if (level > 5) {to += " h5";}
// Traverse the DOM for all elements
$.each(from.nextUntil(to, "h"+level), function() {
// Get the title and the UID
var title = $(this).text();
var aname = "toc_"+uid;
uid++;
// Create an anchor so the user can reach the header element
$(this).append('<a name="'+aname+'"/>');
// Create the TOC entry
content += '<li><a href="#'+aname+'">'+title+'</a>';
// "We need to go deeper"
if (level < 6) { // This is where you choose the maximum depth
content += getTOCLevel($(this), level+1);
}
content += '</li>';
});
if (content == '') {return "";}
return '<ul>' + content + '</ul>';
}
$(document).ready(function() {
// Parse each TOC
$.each($(".toc"), function() {
// Generate the TOC
var toccontent = getTOCLevel($(this), 2);
if (toccontent == "") {
$(this).hide();
} else {
$(this).append(toccontent);
$(this).show();
}
});
});</pre>
<h4>Dans le css ajoutez/personnalisez:</h4>
<pre class="brush: css">.toc {
background-color: #FFFFFF;
border: 1px solid #8CACBB;
padding: 0.5em 0 0.7em;
text-align: left;
color: #1D2B4F;
margin-bottom: 10px;
clear: both;
float: right;
font-size: 80%;
margin: 1.2em 0 0 2em;
width: 200px;
z-index: 10;
}
.toc a{color: #1D2B4F;}
.toc ul{padding: 2px; margin:10px;}
.toc ul li{padding-bottom: 4px;}</pre>
<h3>Finaliser l'installation</h3>
<p>Changez de thème et remettez votre thème pour que dotclear prenne en compte toutes les modifications.</p>
<p>Evidemment, si un pluggin qui fait ça manque à dotclear, c'est c'est parcequ'il est un moteur de blog. Mon utilisation du blog du grouik, se situe entre le blog et le wiki.</p>
<div class="footnotes"><h4>Note</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2012/06/28/Dotclear%2C-ajouter-une-table-des-mati%C3%A8res-dans-un-billet#rev-wiki-footnote-1" id="wiki-footnote-1">1</a>] Le principe de faire un script qui parcourt l'ensemble d'une page html pour l'adapter est assez moche, j'en conviens. La création d'un plugin qui génère le sommaire "en dur" dans le code html du billet n'est pas évident, et je ne suis ni assez callé sur ce cms, ni certain que ce soit possible via l'api dotclear.</p></div>
Un filtre antispam supplémentaire pour dotclearurn:md5:667553a4d2e96b20de594c4177de24ae2011-11-12T15:00:00+01:002011-11-12T15:13:21+01:00gniearkdev webdotclearspam <p><img src="https://blog-du-grouik.tinad.fr/public/.spam-e0a18_s.jpg" alt="kill the spam" style="float:left; margin: 0 1em 1em 0;" title="kill the spam, mar. 2009" />J'ai remarqué que les spammeurs qui sévissent sur mon blog, ont souvent ces deux points communs:</p>
<ul>
<li>Le nom de l'auteur contient la description du site dont il fait la promotion, souvent plus de trois mots.</li>
<li>Il a renseigné un lien vers un site internet, évidemment.</li>
</ul>
<p>Vu que dans les commentaires légitimes, je n'en trouve pas un seul répondant à ces deux contraintes, je viens d'écrire le petit pluggin qui ajoute le filtre "3Words1Link".</p>
<p>Il est tout simple:</p>
<p>Un lien renseigné + le nom découpé en au moins 3 mots = spam</p>
<p>Vous pouvez le télécharger là: <a href="https://blog-du-grouik.tinad.fr/public/filter3Words1Link.zip">filter3Words1Link.zip</a></p>
<p>Il s'installe comme n'importe quel pluggin, et apparait dans la liste des filtres de l'antispam de dotclear.</p>Blogilo avec dotclearurn:md5:45cad996c1c980c6792494a7ed73981a2011-07-24T23:25:00+02:002011-07-25T18:15:25+02:00gniearkNunuxdotclearfedora <p>C'est tout simple. (et pourtant j'ai un peu lutté). Blogilo est un client de blog pour linux installé par défaut sur fedora KDE que je découvre. Dotclear est le CMS de ce blog, il permet le XML/RPC utilisé par blogilo.</p>
<h3>Autoriser XML/RPC sur le blog</h3>
<p>Sur l'interface de dotclear, allez dans "extensions:aboutconfig" > onglet "parametres globaux" </p>
<p>Puis passez la valeur enable_xmlrpc à "oui".</p>
<p><img src="http://blog-du-grouik.tinad.fr/public/enablexmlrpc2.jpg" /></p>
<p>Maintenant, rendez vous dans les paramètres du blog pour constater qu'en bas, il vous donnes les paramètres pour connecter votre blog à votre client (Blogilo dans notre cas).</p>
<p><img src="http://blog-du-grouik.tinad.fr/public/recapxmlrpc.jpg" /></p>
<h3>Configurer blogilo</h3>
<p>Blog>Ajouter un blog</p>
<p>Entrez l'url du serveur obtenue ci dessus. Votre identifiant puis votre mot de passe.</p>
<p>Il ajoutera /xmlrpc.php à l'URL :D pas gênant, ça marche quand même je suppose que dotclear ne fait pas attention à cette variable supplémentaire.</p>
<p><img src="http://blog-du-grouik.tinad.fr/public/blogilo1.jpg" /></p>
<p>Et vérifier dans l'onglet avancés que les paramètres sont cohérents avant d'ajouter le blog.</p>
<p><img src="http://blog-du-grouik.tinad.fr/public/blogilo2.jpg" /></p>
<p>ça marche et c'est assez intuitif!</p>
<p><img src="http://blog-du-grouik.tinad.fr/public/blogilo3.jpg" /></p>
<h3>Il y a quand même un petit défaut dans ce mode d'édition</h3>
<p>Il gère le transfert des images avec dotclear. C'est assez impressionnant le standard xmlrpc en fait. Sauf que dans l'interface web de dotclear, quand on uploade une image il en fait des miniatures (sauf erreur de ma part wordpress ne le fait pas et les wordpressiens se galèrent à redimensionner les images préalablement... la loose hein? surtout que des redimensionnements en php via gd, ça ne demande pas des centaines de lignes de code non plus.). Et si vous n'êtes pas bêtes, vous avez configuré pour que par défaut, la miniature de taille moyenne fasse pile poil la largeur de la colonne. Avec Blogilo, il faut redimensionner préalablement (si on précise une largeur il va simplement placer une balise width). Et c'est limage originale qui est publiée, pas la miniature.</p>
<p>Le truc c'est qu'en cas de modification du template et de la largeur de la colonne des billets. Il est possible via quelques manipulations de sioux sous dotclear de refaire toutes les miniatures à partir des originaux uploadés. là avec Blogilovous ne disposerez pas des grands formats.</p>
<p>Allez, je publie ce billet depuis Blogilo ou je vérifie d'abord sur l'interface web de dotclear?</p>Creer une application multi Vhosturn:md5:7b4422b49affbc0cf5108d60ba9e85652011-03-10T18:49:00+01:002011-03-14T20:11:54+01:00gniearkdev webApachedotclearPHPTutoriel-mémo <p><img src="https://blog-du-grouik.tinad.fr/public/.php_m.jpg" alt="php.jpg" style="display:block; margin:0 auto;" title="php.jpg, août 2010" />
Quelques mots de conception. Ce n'est pas LA solution, c'est un peu brouillon, mais je vais tenter de d'expliquer ici les idées et principes que j'applique actuellement dans la réécriture de l'application tinaderp en version plateforme.</p>
<p>Beaucoup de concepts que j'utilise proviennent de l'observation de dotclear en version multiblog.</p>
<p>L'idée, c'est que j'ai une application web qui va servir à un groupe d'utilisateurs. Pour qu'elle serve à un autre groupe, depuis un autre VHOST, le plus simple aurait été de faire une base de données nommée autrement et de copier tout le VHOST d'origine dans le nouveau... puis changer les paramètres de connexion mysql.</p>
<p>Oui, mais comme ça, je me taperai les mises à jour sur chaque site, un par un. Et comme beaucoup, je ne supporte pas les taches fastidieuses, quitte à me compliquer la vie pour les éviter.</p>
<p>Voyons rapidement la sécurisation du cross vhost, puis l'organisation des fichiers.</p>
<h2>Quelques définitions</h2>
<p>Oui, il y a quelques termes que j'emploie, peut être à mauvais escient, qui peuvent porter à confusion:</p>
<h4>VHOST:</h4>
<p>C'est un VirtualHost.
Il se définit principalement par son adresse URL et un dossier sur le serveur.
sur ce serveur par exemple, parmis la dizaine de vhost on trouve:</p>
<table border="1">
<tr><th>Dossier sur le serveur</th><th>URL d'acces</th></tr>
<tr><td>/var/www/blog-du-grouik.tinad.fr/</td><td>http://blog-du-grouik.tinad.fr</td></tr>
<tr><td>/var/www/www.tinad.fr/</td><td>http://www.tinad.fr</td></tr>
</table>
<h4>Framework</h4>
<p>C'est le socle de l'application. La partie de code qui gère l'authentification des utilisateurs et les différents modules.</p>
<h4>Module</h4>
<p>Bah c'est un menu quoi</p>
<h2>Configuration serveur</h2>
<h3>Apache en cross Vhost, un user unix par Vhost</h3>
<p>J'organise l'application comme un système d'application: les programmes d'un coté, la "data" des usagers de l'autre. Les utilisateurs pouvant uniquement lire et exécuter les applications. et ne pouvant pas lire la data du voisin.
Pour le test, je vais me faire trois vhost <sup>[<a href="https://blog-du-grouik.tinad.fr/post/2011/03/14/Creer-une-application-multi-Vhost#pnote-856-1" id="rev-pnote-856-1">1</a>]</sup>:</p>
<ul>
<li>vhost.tinad.fr</li>
<li>vhost1.tinad.fr</li>
<li>vhost2.tinad.fr</li>
</ul>
<p>vhost.tinad.fr contient les scripts php
vhost1.tinad.fr et vhost2.tinad.fr contient les fichiers servant séparément aux deux groupes (les documents déposés dans le cas d'une GED par exemple).</p>
<p>Le serveur apache, bien que lancé et configuré par root utilise un compte linux pour l’accès aux fichiers du site internet, généralement www-data. Dans un fichier php, on peut très bien lui demander d'aller chercher (avec un "include" ou autre) dans un fichier qui ne se trouve pas dans le répertoire du vhost. Le daemoon utilise pour ça le compte systeme www-data. Suffit juste que ce dernier ait un accès, on peut aller n'importe où sur le serveur.</p>
<p>Ils ont les fichiers de configuration très basique suivants:</p>
<pre>
<VirtualHost *:80>
ServerName vhost.tinad.fr
DocumentRoot /var/www/vhost.tinad.fr
</VirtualHost>
</pre>
<pre>
<VirtualHost *:80>
ServerName vhost1.tinad.fr
DocumentRoot /var/www/vhost1.tinad.fr
</VirtualHost>
</pre>
<pre>
<VirtualHost *:80>
ServerName vhost2.tinad.fr
DocumentRoot /var/www/vhost2.tinad.fr
</VirtualHost>
</pre>
<p>Juste pour l'explication de ce que j'appelle le cross vhost,
Je créé le fichier /var/www/vhost1.tinad.fr/plop.html suivant:</p>
<pre>[htm]
<h1>plop</h1>
</pre>
<p>Puis le fichier /var/www/vhost2.tinad.fr/index.php suivant:</p>
<pre class="php php" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><p>le site voisin dit:</p></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;"><?php</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">include</span> <span style="color: #009900;">(</span><span style="color: #0000ff;">"../vhost1.tinad.fr/plop.html"</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?></span></div></li></ol></pre>
<p>Résultat:</p>
<p><a href="https://blog-du-grouik.tinad.fr/public/crossvhost.jpg" title="crossvhost.jpg"><img src="https://blog-du-grouik.tinad.fr/public/.crossvhost_m.jpg" alt="crossvhost.jpg" title="crossvhost.jpg, mar. 2011" /></a></p>
<p>Le premier principe de conception va être d'utiliser cette possibilité sans que ce soit une épée de Damocles, permettant à tout script kiddie de pourrir tous les vhost à la moindre faille dans un script php.</p>
<h3>Sécuriser le cross vhost en utilisant la gestion des droits d'accès aux fichiers du noyau linux</h3>
<p>On va créer trois comptes système linux, un par VHOST</p>
<pre class="bash bash" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#Creer les users (l'option -r signifie compte systeme, ne peut pas se connecter sur la machine)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">useradd <span style="color: #660033;">-r</span> vhost</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">useradd <span style="color: #660033;">-r</span> vhost1</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">useradd <span style="color: #660033;">-r</span> vhost2</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#mettre vhost1 et vhost2 dans le groupe vhost (ils auront ainsi un acces lecture et exécution)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usermod <span style="color: #660033;">-a</span> <span style="color: #660033;">-G</span> vhost vhost1</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usermod <span style="color: #660033;">-a</span> <span style="color: #660033;">-G</span> vhost vhost2</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#leur donner les dossiers</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> vhost:vhost <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhost.tinad.fr</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> vhost1:vhost1 <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhost1.tinad.fr</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> vhost2:vhost2 <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhost2.tinad.fr</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#Installer un module apache qui permet de définir l'user linux utilisé pour le vhost:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> apache2-mpm-itk</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#on autorise le groupe et l'user seulement:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">750</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhost<span style="color: #000000; font-weight: bold;">*</span></div></li></ol></pre>
<p>On modifie à nouveau les fichiers de configuration des vhost comme ceci.</p>
<pre>
<VirtualHost *:80>
ServerName vhost2.tinad.fr
DocumentRoot /var/www/vhost2.tinad.fr
<IfModule mpm_itk_module>
AssignUserId vhost2 vhost2
</IfModule>
</VirtualHost>
</pre>
<p>idem pour les 2 autres vhost en remplaçant par le bon user linux, le bon serverName et le bon DocumentRoot.</p>
<p>Résultat:
<a href="https://blog-du-grouik.tinad.fr/public/lesitecoisinfail.jpg" title="lesitecoisinfail.jpg"><img src="https://blog-du-grouik.tinad.fr/public/.lesitecoisinfail_m.jpg" alt="lesitecoisinfail.jpg" style="display:block; margin:0 auto;" title="lesitecoisinfail.jpg, mar. 2011" /></a></p>
<p>Voila, on n'a plus accès aux sites voisins, et un acces en lecture/execution uniquement des exécutables. ça fait plus rigoureux.</p>
<h2>Organisation des fichiers:</h2>
<p>Dans les dossiers des vhost clients, (vhost1.tinad.fr et vhost2.tinad.fr)</p>
<p>je dépose juste un index.php ce cette manière, façon dotclear<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2011/03/14/Creer-une-application-multi-Vhost#pnote-856-2" id="rev-pnote-856-2">2</a>]</sup>:</p>
<pre class="php php" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;"><?php</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">//Un identifiant qui permet au programme de savoir à quel site il a à faire </span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">'intra_id'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'0'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">//On renvoit tout ensuite sur l'application en elle meme</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">require</span> <a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">(</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/../vhost.tinad.fr/prepend.php'</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?></span></div></li></ol></pre>
<p>Et ensuite dans le prepend.php, le code du site se déroule normalement. Il va y avoir une petite galère avec ce système. Toutes les URL doivent passer par par index.php. Les css, le js, les images et les validations de formlaires.
CSS et image, perso j'ai ajouté sur chaque vhost fait un lien symbolique en plus de l'index.php.</p>
<p>Pour le js. Je le génère directement dans le code html, pas de link. Le framework en lui même n'a pas de javascript. Par contre les différents modules oui... je présente au navigateur uniquement le JS qui sert au module (la partie de l'application) en cours d'affichage.</p>
<p>Pour la validation des formulaires, Pareil, je pique la méthode dotclear.</p>
<pre class="php php" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;"><?php</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> xd_check_input<span style="color: #009900;">(</span><span style="color: #000088;">$id</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">/*</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"> *On génére un hash aléatoire qui sera </span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"> *ajouté aux formulaires, afin d'ajouter </span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"> *une vérification supplémentaire</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"> *lors du traitement de ce dernier</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"> */</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span><span style="color: #009900;">(</span><span style="color: #339933;">!</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'xd_check'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">//le générer</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'xd_check'</span><span style="color: #009900;">]</span><span style="color: #339933;">=</span>rand_str<span style="color: #009900;">(</span><span style="color: #cc66cc;">25</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$id</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">"<input type=<span style="color: #000099; font-weight: bold;">\"</span>hidden<span style="color: #000099; font-weight: bold;">\"</span> name=<span style="color: #000099; font-weight: bold;">\"</span>xd_check<span style="color: #000099; font-weight: bold;">\"</span> id=<span style="color: #000099; font-weight: bold;">\"</span>xd_check<span style="color: #000099; font-weight: bold;">\"</span> value=<span style="color: #000099; font-weight: bold;">\"</span>"</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'xd_check'</span><span style="color: #009900;">]</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"<span style="color: #000099; font-weight: bold;">\"</span>>"</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">"<input type=<span style="color: #000099; font-weight: bold;">\"</span>hidden<span style="color: #000099; font-weight: bold;">\"</span> name=<span style="color: #000099; font-weight: bold;">\"</span>xd_check<span style="color: #000099; font-weight: bold;">\"</span> value=<span style="color: #000099; font-weight: bold;">\"</span>"</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'xd_check'</span><span style="color: #009900;">]</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"<span style="color: #000099; font-weight: bold;">\"</span>>"</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?></span></div></li></ol></pre>
<p>La function précédente me permet de générer facilement un input que je place dans chaque formulaire.</p>
<p>Ainsi, je peux détecter au tout début du code avant même le premier header, si un formulaire est soumis:</p>
<pre class="php php" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//sousmission d'un formulaire</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'xd_check'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">//vérifier le numero de formulaire</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #009900;">(</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'xd_check'</span><span style="color: #009900;">]</span><span style="color: #339933;">!=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'xd_check'</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span> AND <span style="color: #009900;">(</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'xd_check'</span><span style="color: #009900;">]</span> <span style="color: #339933;">!=</span><span style="color: #0000ff;">""</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> erreur <span style="color: #009900;">(</span><span style="color: #0000ff;">'Validation du formulaire incorrecte'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">//C'est ok, on envoie vers le code qui gere les formulaires</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$modules</span><span style="color: #009900;">[</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'menu'</span><span style="color: #009900;">]</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">require_once</span> <span style="color: #009900;">(</span>engine_path<span style="color: #339933;">.</span><span style="color: #0000ff;">"/"</span><span style="color: #339933;">.</span><span style="color: #000088;">$modules</span><span style="color: #009900;">[</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'menu'</span><span style="color: #009900;">]</span><span style="color: #009900;">]</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">]</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/_act.php'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">}</span></div></li></ol></pre>
<p>Ce qui est pratique, c'est que du coup, je n'ai pas à gerer de redirection, les modifications engendrées par la validation du formulaire seront prises en compte immédiatement.</p>
<h3>Les données de chaque groupe</h3>
<p>Elles sont soit dans la base de données, soit, si c'est un fichier dans un dossier qui est sur leur propre Vhost. J'avais fait une <a href="https://blog-du-grouik.tinad.fr/post/2010/03/09/envoyer-un-fichier-au-navigateur-en-php">explication de la technique pour les protéger d'un accès direct par leur URL</a>.</p>
<h3>L'organisation en framework</h3>
<p>La racine du vhost principal contient</p>
<ul>
<li>index.php</li>
<li>Un fichier php contrenant la liste des modules, noms, path, état actif ou non.</li>
<li>Un dossier inc pour toutes les functions, images etc... propre au framework et les objets communs à tous les modules</li>
<li>Un dossier par module.</li>
</ul>
<p>Chaque dossier de module contient:</p>
<ul>
<li>_act.php les actions générées suite à la validation des formulaires</li>
<li>_index.php l'affichage utilisateur</li>
<li>_js.js Le code javascript propre au module (il sera placé par le framework dans le header de la page)</li>
<li>_logo.png Bah pour le menu, le logo du module.</li>
</ul>
<h3>Conclusion.</h3>
<p>C'est brouillon hein? Mais je suis reparti de cette manière, je recode tout dans ce principe, c'est fastidieux, mais quand ce sera fini, je serai sur une meilleure base pour tous les développements qui attendent, et pour une version multisite.</p>
<div class="footnotes"><h4>Notes</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2011/03/14/Creer-une-application-multi-Vhost#rev-pnote-856-1" id="pnote-856-1">1</a>] Cherchez pas, je les effacerai avant de publier ce billet.</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2011/03/14/Creer-une-application-multi-Vhost#rev-pnote-856-2" id="pnote-856-2">2</a>] Ça sert à ça aussi le logiciel libre, partager des méthodes de codage</p></div>
Les avatars dans les commentairesurn:md5:2d8d0b9aff51856b47ffc409e8513b062011-02-20T23:56:00+01:002011-02-21T00:00:38+01:00gniearkbrevesdotclear <p><img src="https://blog-du-grouik.tinad.fr/public/.gravatar_s.jpg" alt="gravatar.jpg" style="float:left; margin: 0 1em 1em 0;" title="gravatar.jpg, fév. 2011" />J'ai mis en place les gravatars dans les commentaires de ce blog. Parce que celui de de zigazou est sympa et c'était dommage de ne pas le voir.</p>
<p>Le comment que j'ai fait?</p>
<p>Heu bah heu pareil que d'habitude, si je n'ai pas l'impression de pouvoir apporter de plus-value dans une explication par rapport à une documentation utilisée, je colle juste un lien:</p>
<p><a href="http://www.geeek.org/post/2009/02/14/Astuce-Dotclear-5-%3A-Gravatar-tu-utiliseras">http://www.geeek.org/post/2009/02/14/Astuce-Dotclear-5-%3A-Gravatar-tu-utiliseras</a></p>
<p>Quand à l'avatar par défaut si le commentateur n'a pas de compte de gravatar: Un grouik.</p>Modification de toutes les URL de ce blogurn:md5:320513932fea03ec608f46d3c615999e2011-02-14T19:09:00+01:002011-02-14T19:13:04+01:00gniearkdev webdotcleargoogle <p>Un problème de "duplicate content": <br />
La page "index.php" et la page "/" étaient les mêmes.</p>
<p>420 URL indexées par Google, je me suis permis quand même d'opter pour la solution bourrin: le passage de QUERY_STRING en PATH_INFO. Traduction: Les "index.php?" présents dans les URL de ce blog ont été retirés.</p>
<p>Pour la méthode, je ne vais pas l'expliquer car Djib l'a très bien fait sur son blog Think Underground : <a href="http://www.think-underground.com/post/2008/11/24/Dotclear-2-:-passage-de-QUERY_STRING-en-PATH_INFO-sans-douleur" hreflang="fr">passage de QUERY_STRING en PATH_INFO sans douleur</a></p>
<p>De temps en temps il m'arrive de coller un lien vers un autre billet.</p>
<p>Pour tous les modifier, c'est à dire retirer les "index.php" dans les liens internes, ça se fait en une requête SQL (Faites une sauvegarde de votre base avant, je ne garantis rien<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2011/02/14/Modification-de-toutes-les-URL-de-ce-blog#pnote-838-1" id="rev-pnote-838-1">1</a>]</sup> et pensez à préciser l'id de votre blog dans la clause WHERE)</p>
<pre class="sql sql" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #993333; font-weight: bold;">UPDATE</span> dc_post </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #993333; font-weight: bold;">SET</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> post_content<span style="color: #66cc66;">=</span><span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">(</span>post_content<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'|index.php?'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'|'</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">,</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> post_content_xhtml<span style="color: #66cc66;">=</span><span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">(</span>post_content_xhtml<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'href="/index.php?'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'"href="/'</span><span style="color: #66cc66;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #993333; font-weight: bold;">WHERE</span> blog_id<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'default'</span></div></li></ol></pre>
<p>Le résultat c'est que plus aucune URL indexée n'est valide. Cependant pour chacune, une redirection 301 <sup>[<a href="https://blog-du-grouik.tinad.fr/post/2011/02/14/Modification-de-toutes-les-URL-de-ce-blog#pnote-838-2" id="rev-pnote-838-2">2</a>]</sup> est faite vers le bon billet. Est-ce que Google et les autres bots vont bien réagir?</p>
<p>La manipulation a été faite hier soir, et j'ai soumis le nouveau sitemap dans la foulée. Une demie heure après Le bot était de passage sur les nouvelles adresses.</p>
<p>Quand aux agrégateurs de flux (oui le flux atom fait aussi l'objet d'une redirection 301), ils sont tous passés sur l'ancien flux (ayant la redirection 301), et ont immédiatement après pris en compte la nouvelle adresse, vu qu'à présent ils ne passent plus que sur la bonne.</p>
<p>Ça c'était hier soir, je regarde de temps en temps comment Google scrawle le site <a href="http://www.google.fr/search?q=site%3Ablog-du-grouik.tinad.fr" hreflang="fr">indexe les nouvelles URL</a>, il a l'air de faire ça très bien, progressivement. On verra!</p>
<div class="footnotes"><h4>Notes</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2011/02/14/Modification-de-toutes-les-URL-de-ce-blog#rev-pnote-838-1" id="pnote-838-1">1</a>] Je suis un lâche</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2011/02/14/Modification-de-toutes-les-URL-de-ce-blog#rev-pnote-838-2" id="pnote-838-2">2</a>] La redirection 301 signifie que l'adresse a changé définitivement</p></div>
googleTools pour dotclear php 5.3urn:md5:8a4850233913dd737856e94ae69227112011-02-07T20:24:00+01:002013-09-14T12:25:12+02:00gniearkbrevesdotclearPHP <p><img src="https://blog-du-grouik.tinad.fr/public/.analitycswtf_m.jpg" alt="analitycswtf.jpg" style="display:block; margin:0 auto;" title="analitycswtf.jpg, fév. 2011" /></p>
<p>Dotclear est très bien passé en php 5.3, sauf le pluggin googleTools (buhaaaa j'ai perdu mes stats de la journée)
L'erreur affichée dans les préférences du blog est la suivante:</p>
<blockquote><p>Warning: Parameter 1 to googlestuffAdminBehaviours: :adminBlogPreferencesForm() expected to be a reference, value given in /var/www/blog-du-grouik.tinad.fr/inc/core/class.dc.core.php on line 304</p></blockquote>
<p>Rien de bien difficile, quelques "&" à supprimer dans les variables au niveau des déclarations de function pour que ça marche.</p>
<p>Voici la version du plugin qui passe en php5.3, mais je pense que ce sera corrigé assez vite sur dottadict:
<a href="https://blog-du-grouik.tinad.fr/public/googleTools.zip">googleTools.zip</a></p>Balises META description en double, sous dotclearurn:md5:9855c9918f1996f9da0124d6975d66572011-01-08T18:53:00+01:002011-01-09T15:10:06+01:00gniearkdev webdotcleargoogletemplate <p><strong>Note:</strong> Ce petit problème mineur (mon blog a très bien vécu pendant plus de deux ans comme ça) a été corrigé avec une grande réactivité par les mainteneurs de dotclear, il y a quelques mois. Il ne s’applique ni aux thèmes utilisant le template par défaut, ni aux thèmes récents. Mais il est encore présent dans une grande partie des thèmes proposés sur dotaddict.</p>
<p>Dans les outils pour les Webmasters de google, il me signale qu'il existe des balises META description en double sur ce blog:
Exactement la même description sur différentes pages.</p>
<p><img src="https://blog-du-grouik.tinad.fr/public/.webmastertoolsmeta_m.jpg" alt="webmastertoolsmeta.jpg" style="display:block; margin:0 auto;" title="webmastertoolsmeta.jpg, janv. 2011" /></p>
<p>Il s'agit en fait des pages d'accueil,:</p>
<ul>
<li>index.php</li>
<li>index.php?/page/2</li>
<li>index.php?/page/3</li>
<li>etc...</li>
</ul>
<p>Sur la page d'accueil ou lorsque on passe aux billets précédents, la description du site (rédigée dans le tableau de bord de dotclear) sert à toutes les pages. Tandis que sur un billet à proprement parler, c'est un extrait de ce dernier qui sert à la description<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2011/01/08/Balises-META-description-en-double%2C-sous-dotclear#pnote-791-1" id="rev-pnote-791-1">1</a>]</sup>.</p>
<p>Si Google dit que c'est mal d'avoir des balises méta en double c'est sûrement que c'est vrai. Je me prosterne.</p>
<p>Pour avoir des descriptions légèrement différentes, le plus simple est d'y ajouter le numéro de la page.
Le code dans le template qui va ajouter <em>Page x</em> sauf sur la première page (autant ne pas allourdir la description de la homepage) est le suivant:</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:PaginationIf</span> <span style="color: #000066;">start</span>=<span style="color: #ff0000;">"0"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:lang page}} {{tpl:PaginationCurrent}} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:PaginationIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li></ol></pre>
<h3>Pour éliminer les métas en double.</h3>
<p>Dans le fichier home.html du template, remplacer:</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><meta</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"description"</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">"{{tpl:BlogLanguage}}"</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">"{{tpl:BlogDescription cut_string="</span>180<span style="color: #ff0000;">" encode_html="</span>1<span style="color: #ff0000;">"}}"</span> <span style="color: #000000; font-weight: bold;">/></span></span></div></li></ol></pre>
<p>par:</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><meta</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"description"</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">"{{tpl:BlogLanguage}}"</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">"<tpl:PaginationIf start="</span>0<span style="color: #ff0000;">"></span></span>{{tpl:lang page}} {{tpl:PaginationCurrent}} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:PaginationIf<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:BlogDescription cut_string="180" encode_html="1"}}" /></div></li></ol></pre>
<p>Remplacez aussi:</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><meta</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"dc.description"</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">"{{tpl:BlogLanguage}}"</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">"{{tpl:BlogDescription encode_html="</span>1<span style="color: #ff0000;">"}}"</span> <span style="color: #000000; font-weight: bold;">/></span></span></div></li></ol></pre>
<p>Par</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><meta</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"dc.description"</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">"{{tpl:BlogLanguage}}"</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">"<tpl:PaginationIf start="</span>0<span style="color: #ff0000;">"></span></span>{{tpl:lang page}} {{tpl:PaginationCurrent}} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:PaginationIf<span style="color: #000000; font-weight: bold;">></span></span></span> {{tpl:BlogDescription encode_html="1"}}" /></div></li></ol></pre>
<div class="footnotes"><h4>Notes</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2011/01/08/Balises-META-description-en-double%2C-sous-dotclear#rev-pnote-791-1" id="pnote-791-1">1</a>] C'est une généralité, mais c'est géré au niveau du template ça, ça dépend de ce dernier</p></div>
Faites F5!urn:md5:c2ccb4320f6bd3998ba520027fdfe8a82011-01-05T04:38:00+01:002011-01-05T05:00:49+01:00gniearkdev webdotcleartemplate <p><img src="https://blog-du-grouik.tinad.fr/public/.gedit-template_m.jpg" alt="gedit-template.jpg" style="display:block; margin:0 auto;" title="gedit-template.jpg, janv. 2011" />
Ah vous pouvez faire F5 pour recharger les images et le CSS de ce site.!</p>
<p>C'est un billet qui revient à rythme assez régulier. Enfin à chaque fois qu'il me prend l'envie de chambouler un peu la présentation du blog.</p>
<p>En nouveautés: il y a une troisième colonne.</p>
<p>La modification de la largeur de la colonne des billets a pour conséquence de faire que les miniatures des images qui étaient dimensionnées pile poil ne le sont plus. La technique pour toutes les régénérer (avec les nouvelles largeurs définies dans les préférences du blog) sans trop en baver est décrite par <a href="http://forum.dotclear.net/viewtopic.php?pid=261252#p261252" hreflang="fr">erational dans le forum de dotclear</a>.</p>
<h3>Sur la page d’accueil</h3>
<p>La colonne du milieu affiche les billets de la catégorie "brèves". C'est ça la nouveauté. Sans non plus tomber dans du twittage, je souhaitais pouvoir écrire des trucs courts sans avoir l'impression de flooder.</p>
<p>Techniquement dans le template pour n'afficher qu'une catégorie, on fait comme ça:</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:Entries</span> <span style="color: #000066;">category</span>=<span style="color: #ff0000;">"breves"</span> <span style="color: #000066;">lastn</span>=<span style="color: #ff0000;">"15"</span> <span style="color: #000066;">ignore_pagination</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">...intérieur d'un post</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:Entries<span style="color: #000000; font-weight: bold;">></span></span></span></div></li></ol></pre>
<p>ignore_pagination="1" permet de ne pas prendre en compte que l'utilisateur soit à la Xème page</p>
<p>La documentation est là: <a href="http://fr.dotclear.org/documentation/2.0/resources/themes/tags/entries" hreflang="fr">http://fr.dotclear.org/documentation/2.0/resources/themes/tags/entries</a></p>
<h3>Sur un billet (post.html dans le template)</h3>
<p>La colonne du milieu affiche un aperçu des billets de la même catégorie, à l'exclusion de de celui en cours. (Logique).
J'avais presque réussi, il ne me manquait plus que l'exclusion du billet à mettre en place, lorsque je suis tombé sur ce <a href="http://tips.dotaddict.org/fiche/Afficher-les-billets-de-la-m%C3%AAme-cat%C3%A9gorie-que-le-billet-courant-en-excluant-celui-ci-de-la-liste" hreflang="fr">tips and sheats</a> de dotclear qui expliquait toute la manip à faire.</p>
<h3>Pages tags et catégories.</h3>
<p>J'y affiche (dans la colonne du milieu la liste des billets au complet).</p>
<h3>Pour finir</h3>
<p>Bah quelques fignolages qui restent à faire et quelques brèves à écrire pour remplir la colonne du milieu.
J'espère que ça rendra mon blog plus fonctionnel; et peut être augmenter le nombre de pages vues par visite. Ah et oui, faut qu' j'aille redimensionner les trucs inclus un peu à l’arraché dans les billets.</p>Galerie de photos super simple V.2urn:md5:a38195c98ce4f6b0be55baa30b0d08ec2011-01-02T18:21:00+01:002011-02-17T09:45:16+01:00gniearkdev webdotclearjavascriptphotographie <h3>Un aperçu avec un dossier de fonds d'écran gnome ou ubuntu:</h3>
<p>Dans index php, pour avoir des thumbnail plus petits, j'ai changé :</p>
<pre>ResizeImage($liste_rep[$i],"thumbnails/".$liste_rep[$i], 100, 100);</pre>
<p>par:</p>
<pre>ResizeImage($liste_rep[$i],"thumbnails/".$liste_rep[$i], 50, 50);</pre>
<div class="external-media" style="margin: 1em auto; text-align: center;">
<iframe src="https://blog-du-grouik.tinad.fr/galeries/photossitetest/" width="450" height="600" frameborder="0"></iframe>
</div>
<p>Dans le billet précédent vous avez été nombreux<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2011/01/02/Galerie-de-photos-super-simple-V.2#pnote-779-1" id="rev-pnote-779-1">1</a>]</sup> à me demander comment j'avais fait pour mettre mon caroussel super simple de photographes.</p>
<p>Ce n'est pas super joli, pas de fondu ou autre, mais je trouve ça simple et efficace. Il s'agit d'une petite amélioration <a href="https://blog-du-grouik.tinad.fr/index.php?post/2010/01/22/un-simple-script-php-de-galerie-photographie">de mon script publié</a> ici il y a 11 mois.</p>
<p>La galerie sur le billet en lui même c'est une iframe:</p>
<pre class="php php" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"><</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">"external-media"</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">"margin: 1em auto; text-align: center;"</span><span style="color: #339933;">></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"><</span>iframe src<span style="color: #339933;">=</span><span style="color: #0000ff;">"/galeries/android/"</span> width<span style="color: #339933;">=</span><span style="color: #0000ff;">"100%"</span> height<span style="color: #339933;">=</span><span style="color: #0000ff;">"730"</span> frameborder<span style="color: #339933;">=</span><span style="color: #0000ff;">"0"</span><span style="color: #339933;">></</span>iframe<span style="color: #339933;">></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;"></</span>div<span style="color: #339933;">></span></div></li></ol></pre>
<p>Oui oui, je sais les iframes c'est mal. mais bien pratique, et je ne veux pas alourdir le <head> de ce site avec du javascript pour un billet seulement. Donc l'iframe c'est bien pratique.</p>
<p>Et ah heu oui, pour insérer du html en mode wiki, on fait comme ça dans un billet:</p>
<p><code>///html</code><br />
<code><insérez votre code html là></code><br />
<code>///</code></p>
<h3>Maintenant, regardons ce que j'ai mis dans /galeries/android; la cible de l'iframe.</h3>
<p>Quand je veux mettre des images, je les dépose tout simplement dans ce dossier (en ftp ou autre). Lors de la prochaine ouverture de la page il va détecter les images qui ont été ajoutées pour créer leurs miniatures qui sont dans le sous dossier thumbnails. (ça peut etre long).</p>
<p>un fichier ./index.php:</p>
<pre class="php php" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><head></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <title>Yael</title></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <meta http-equiv="Content-type" content="text/html;charset=UTF-8" /></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <meta name="COPYRIGHT" content="Site 2010 Blog du Grouik http://blog-du-grouik.tinad.fr Vous êtes libres de copier, redistribuer, de modifier le code source. Merci cependant d'y laisser la paternité si votre modification est nulle ou mineure. Juste pour ma gloire :p"/></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <link rel="stylesheet" href="plop.css" type="text/css" /></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><script type="text/javascript"></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> var x;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> var img;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> function showimg(v)</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> document.getElementById("laphoto").alt = v;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> document.getElementById("laphoto").src = v;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> }</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> function Init() </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img = document.getElementById(document.getElementById("laphoto").alt);</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> x = window.setInterval('chgimg()', 4000);</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> }</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> function chgimg()</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img.style.borderStyle = "none";</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img=img.nextSibling;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> if (!img.nextSibling)</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img=document.getElementById("listedephotos").firstChild;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> }</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> while (img.nodeName != "IMG"){</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img=img.nextSibling;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> }</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> showimg(img.id);</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img.style.borderStyle = "dashed";</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> }</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> function manualshowimg(v)</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img.style.borderStyle = "none";</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img=document.getElementById(v);</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> showimg(v);</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> img.style.borderStyle = "dashed";</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> }</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> window.onload = Init;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"></script></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"></head></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><body></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><div class="all"></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <div id="listedephotos"></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;"><?php</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$liste_rep</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/scandir"><span style="color: #990000;">scandir</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">"./"</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">include</span><span style="color: #009900;">(</span><span style="color: #0000ff;">"thumbnails/thumbnails.php"</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$num</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">while</span><span style="color: #009900;">(</span><span style="color: #000088;">$i</span> <span style="color: #339933;"><</span> <span style="color: #000088;">$num</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #009900;">(</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #000088;">$i</span><span style="color: #009900;">]</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">)</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'.JPG'</span><span style="color: #009900;">)</span><span style="color: #339933;">||</span><span style="color: #009900;">(</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #000088;">$i</span><span style="color: #009900;">]</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">)</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'.jpg'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">"thumbnails/"</span><span style="color: #339933;">.</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #000088;">$i</span><span style="color: #009900;">]</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">//créer la miniature</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> ResizeImage<span style="color: #009900;">(</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #000088;">$i</span><span style="color: #009900;">]</span><span style="color: #339933;">,</span><span style="color: #0000ff;">"thumbnails/"</span><span style="color: #339933;">.</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #000088;">$i</span><span style="color: #009900;">]</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">100</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">" <img onclick=<span style="color: #000099; font-weight: bold;">\"</span>manualshowimg('"</span><span style="color: #339933;">.</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #000088;">$i</span><span style="color: #009900;">]</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"');<span style="color: #000099; font-weight: bold;">\"</span> src=<span style="color: #000099; font-weight: bold;">\"</span>thumbnails/"</span><span style="color: #339933;">.</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #000088;">$i</span><span style="color: #009900;">]</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"<span style="color: #000099; font-weight: bold;">\"</span> id=<span style="color: #000099; font-weight: bold;">\"</span>"</span><span style="color: #339933;">.</span><span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #000088;">$i</span><span style="color: #009900;">]</span><span style="color: #339933;">.</span><span style="color: #0000ff;">"<span style="color: #000099; font-weight: bold;">\"</span> alt=<span style="color: #000099; font-weight: bold;">\"</span>img<span style="color: #000099; font-weight: bold;">\"</span>/><span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$i</span><span style="color: #339933;">++;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"></div></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><div></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <img id="laphoto" src="<span style="color: #000000; font-weight: bold;"><?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">]</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?></span>" alt="<span style="color: #000000; font-weight: bold;"><?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$liste_rep</span><span style="color: #009900;">[</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">]</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?></span>" /></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"></div></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"></div></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"></body></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"></html></div></li></ol></pre>
<p>un fichier pour le css; ./plop.css:</p>
<pre class="css css" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">body <span style="color: #00AA00;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#0F1415</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Verdana<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #cc00cc;">#listedephotos</span><span style="color: #00AA00;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">position</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">500px</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">95%</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #cc00cc;">#laphoto</span><span style="color: #00AA00;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5%</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">95%</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #cc00cc;">#listedephotos</span> img<span style="color: #00AA00;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">}</span></div></li></ol></pre>
<p>et un dossier thumbnails qui contient le fichier ./thumbnails/thumbnails.php suivant:</p>
<pre class="php php" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;"><?php</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">function</span> ResizeImage<span style="color: #009900;">(</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newimage</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newwidth</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newheight</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #666666; font-style: italic;">// fonction récupérée là http://www.wikistuce.info/doku.php/php/miniatures_images</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">'ImageTypes'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/list"><span style="color: #990000;">list</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span><span style="color: #000088;">$height</span><span style="color: #339933;">,</span><span style="color: #000088;">$type</span><span style="color: #009900;">)</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/getimagesize"><span style="color: #990000;">GetImageSize</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$image</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$im</span> <span style="color: #339933;">=</span> ReadImageFromFile<span style="color: #009900;">(</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$newwidth</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$newwidth</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #000088;">$newheight</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$height</span><span style="color: #009900;">)</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$width</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$newheight</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$newheight</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #000088;">$newwidth</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$width</span><span style="color: #009900;">)</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$height</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">(</span><span style="color: #000088;">$newheight</span> <span style="color: #339933;">&&</span> <span style="color: #009900;">(</span><span style="color: #000088;">$width</span> <span style="color: #339933;"><</span> <span style="color: #000088;">$height</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$newwidth</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #000088;">$newheight</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$height</span><span style="color: #009900;">)</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$width</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$newheight</span> <span style="color: #339933;">=</span> <span style="color: #009900;">(</span><span style="color: #000088;">$newwidth</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$width</span><span style="color: #009900;">)</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$height</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">'ImageCreateTrueColor'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$im2</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagecreatetruecolor"><span style="color: #990000;">ImageCreateTrueColor</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$newwidth</span><span style="color: #339933;">,</span><span style="color: #000088;">$newheight</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$im2</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagecreate"><span style="color: #990000;">ImageCreate</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$newwidth</span><span style="color: #339933;">,</span><span style="color: #000088;">$newheight</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">'imagealphablending'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/imagealphablending"><span style="color: #990000;">imagealphablending</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$im2</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">'imagesavealpha'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/imagesavealpha"><span style="color: #990000;">imagesavealpha</span></a> <span style="color: #009900;">(</span><span style="color: #000088;">$im2</span> <span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">'ImageCopyResampled'</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/imagecopyresampled"><span style="color: #990000;">ImageCopyResampled</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$im2</span><span style="color: #339933;">,</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$newwidth</span><span style="color: #339933;">,</span><span style="color: #000088;">$newheight</span><span style="color: #339933;">,</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span><span style="color: #000088;">$height</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <a href="http://www.php.net/imagecopyresized"><span style="color: #990000;">ImageCopyResized</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$im2</span><span style="color: #339933;">,</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$newwidth</span><span style="color: #339933;">,</span><span style="color: #000088;">$newheight</span><span style="color: #339933;">,</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span><span style="color: #000088;">$height</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span>WriteImageToFile<span style="color: #009900;">(</span><span style="color: #000088;">$im2</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newimage</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">function</span> ReadImageFromFile<span style="color: #009900;">(</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000088;">$imagetypes</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagetypes"><span style="color: #990000;">ImageTypes</span></a><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">switch</span> <span style="color: #009900;">(</span><span style="color: #000088;">$type</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$imagetypes</span> <span style="color: #339933;">&</span> IMG_GIF<span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$im</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/imagecreatefromgif"><span style="color: #990000;">ImageCreateFromGIF</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$filename</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$imagetypes</span> <span style="color: #339933;">&</span> IMG_JPEG<span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <a href="http://www.php.net/imagecreatefromjpeg"><span style="color: #990000;">ImageCreateFromJPEG</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$filename</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #000088;">$imagetypes</span> <span style="color: #339933;">&</span> IMG_PNG<span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <a href="http://www.php.net/imagecreatefrompng"><span style="color: #990000;">ImageCreateFromPNG</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$filename</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000000; font-weight: bold;">function</span> WriteImageToFile<span style="color: #009900;">(</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">switch</span> <span style="color: #009900;">(</span><span style="color: #000088;">$type</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <a href="http://www.php.net/imagegif"><span style="color: #990000;">ImageGIF</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <a href="http://www.php.net/imagejpeg"><span style="color: #990000;">ImageJpeg</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">85</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <a href="http://www.php.net/imagepng"><span style="color: #990000;">ImagePNG</span></a><span style="color: #009900;">(</span><span style="color: #000088;">$im</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?></span></div></li></ol></pre>
<p>Voilou voilou. Je reconnais que c'est aussi parce que paradoxalement je n'aime pas trop les plugins de galerie de dotclear (pas assez user friendly peut etre) et aussi que je ne veux pas qu'il y ait une jquery, et d'autres scripts javascript pesant plusieurs mégas en permanence dans le <head> du code mon blog. Cependant la refonte du gestionnaire de médias de dotclear est apparemment prévu dans les développements à venir<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2011/01/02/Galerie-de-photos-super-simple-V.2#pnote-779-2" id="rev-pnote-779-2">2</a>]</sup>.</p>
<div class="footnotes"><h4>Notes</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2011/01/02/Galerie-de-photos-super-simple-V.2#rev-pnote-779-1" id="pnote-779-1">1</a>] Non je fabule, mais ça me fait plaisir d'introduire ce billet de cette manière.</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2011/01/02/Galerie-de-photos-super-simple-V.2#rev-pnote-779-2" id="pnote-779-2">2</a>] <a href="http://fr.dotclear.org/blog/post/2010/11/29/Etat-des-lieux-en-d%C3%A9cembre" hreflang="fr">Blog Dotclear » Etat des lieux en décembre</a></p></div>
dotclear multi siteurn:md5:e63a2843f44fcfff9d68ad22bf5592c12010-12-01T13:41:00+01:002010-12-03T08:42:55+01:00gniearkServeurs http web et autresdotclear <p>Dans mon cas ça ne sert qu'a avoir la même page d'admin pour tous les blogs. mais ça peut être une piste pour fournir des blogs à du monde de manière automatisée. Mais ça ce sera l'objet d'un prochain billet.</p>
<p>Il y a d'autres tutos là dessus que je n'ai pas trouvé super limpides, et je pense pas faire mieux mais je vais tenter. (relecture: po fait mieux)</p>
<h3>Architecture</h3>
<ul>
<li>http://blog-du-grouik.tinad.fr est mon blog déja existant. logé sur le serveur dans /var/www/blog-du-grouik.tinad.fr/</li>
<li>http://osef.tinad.fr est le nouveau blog logé sur le serveur dans /var/www/osef.tinad.fr/ (vide pour le moment)</li>
</ul>
<p>Je ne reprends pas ici la configuration d'apache pour plusieurs sites. exemples là <a "href="https://blog-du-grouik.tinad.fr/post/2010/12/03/Se-simplifier-la-gestion-des-DNS-et-des-VHOST-Apache-multisite">(vhost et dns</a>) et là (memo<a "href="https://blog-du-grouik.tinad.fr/post/2009/06/29/m%C3%A9mo-serveur-web-pour-les-nuls"> apache complet</a>)
Il n'y a pas de protection entre les différents VHOST qui maintiendrait les scripts php dans le vhost en cours. si vous trouvez une seule faille sur un des sites tinad.fr, vous pouvez tous les pourrir.</p>
<h3>Installer quelques trucs dans /var/www/osef.tinad.fr/</h3>
<ul>
<li>Un fichier index.php qui indique à osef d'aller chercher le moteur dotclear du blogdugrouik comme ceci:</li>
</ul>
<pre class="php php" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;"><?php</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">'DC_BLOG_ID'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'osef'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;"># identifiant du blog</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #b1b100;">require</span> <a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">(</span><a href="http://www.php.net/file"><span style="color: #990000;">FILE</span></a><span style="color: #009900;">)</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/../blog-du-grouik.tinad.fr/inc/public/prepend.php'</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">?></span></div></li></ol></pre>
<ul>
<li>Créer un dossier public</li>
<li>Créer un dossier thèmes dans lequel je copie juste le theme /themes/default.</li>
</ul>
<p>Pour les dossiers, C'est facultatif, il y a moyen de lui faire tout gérer sur le même dossier de themes, mais ça aurait eu pour inconvéniant de créer des requetes sur http://blog-du-grouik.tinad.fr pour les images du theme lors de l'affichage de http://osef.tinad.fr. Donc une requête DNS de plus pour le navigateur de l'utilisateur.</p>
<h3>Créer le nouveau blog dans le panneau d'administration de dotclear:</h3>
<p>Menu de gauche du panneau d'administration du blog du grouik > blogs> Creer un nouveau blog</p>
<p>Adaptez la suite à votre blog:
Identifiant:</p>
<pre>
osef
</pre>
<p>Nom du blog :</p>
<pre>
osef
</pre>
<p>URL du blog:</p>
<pre>
http://osef.tinad.fr/index.php/
</pre>
<p>Methode de lecture de l'url:</p>
<pre>
PATH_INFO
</pre>
<h3>Paramétrer le nouveau blog:</h3>
<p>Dans l'interface d'administration, mettez vous sur le nouveau blog "osef" et un petit tour dans le about:config. On change les valeurs suivantes:</p>
<h4>le dossier public</h4>
<p>public_path</p>
<pre>
../osef.tinad.fr/public
</pre>
<p>public_url</p>
<pre>
/public
</pre>
<h4>le dossier de themes (dans lequel on a poussé obligatoirement en plus des themes supplémentaires) le theme default</h4>
<p>themes_path</p>
<pre>
../osef.tinad.fr/themes
</pre>
<p>themes_url</p>
<pre>
/themes
</pre>
<p>Il aurait été possible aussi d'au lieu de créer des dossiers themes et/ou public, de creer un lien symbolique vers ceux du blog du grouik, si j'aurai souhaité partager les médias ou les themes entre les deux blogs, sans toutefois génerer des requetes blogdugrouik lors de l'affichage du blog osef.</p>
<p>Voila, normalement ça marche.</p>
<p><a href="http://osef.tinad.fr" hreflang="fr">http://osef.tinad.fr</a> existe vraiment, mais on s'en fout.</p>
<h4>Documentation:</h4>
<ul>
<li><a href="http://www.pyeb.net/post/2007/01/06/Multiblog-avec-Dotclear-2-et-sous-domaine-avec-lhebergeur-11" hreflang="fr">pyeb.net- Multiblog avec Dotclear 2 et sous-domaine avec l'hébergeur 1&1</a></li>
<li><a href="http://fr.dotclear.org/documentation/2.0/admin/clean-install" hreflang="fr">Documentation officielle dotclear</a></li>
</ul>Dotclear mot de passe QUE sur le contenu d'un billeturn:md5:c2c861a3a8fe7668231e1d58c048c7dc2010-11-07T21:28:00+01:002012-06-25T09:45:45+02:00gniearkdev webAJAXdotclearPHPTutoriel-mémo <p><img src="https://blog-du-grouik.tinad.fr/public/billet-test-la-cigale-et-l-fourmi.jpg" alt="billet-test-la-cigale-et-l-fourmi.jpg" style="display:block; margin:0 auto;" title="billet-test-la-cigale-et-l-fourmi.jpg, nov. 2010" /></p>
<p>L'image ci dessus explique tout, le désir c'est de protéger des billets par un simple mot de passe. Mais il faut que:</p>
<ul>
<li>Le billet reste listé sur le blog</li>
<li>le titre le content exerp toussa idem</li>
<li>C'est juste le contenu du billet qu'on va remplacer par un formulaire mot de passe.</li>
</ul>
<p>Ce n'est pas pour ce blog, mais pour le site du réseau d'établissement gériatriques. Ils ne souhaitent pas que les comptes rendus de réunion, qui sont mis en billets soient totalement publics. (rien de très confidentiel, au contraire, c'est simplement une crainte d'image négative)</p>
<p>Dotclear propose un système de mots de passes aux billets. Il a pour effet secondaire de faire que le billet n'est plus visible sur la page d'accueil.
Il existe aussi un pluggin <a href="http://lab.dotclear.org/wiki/plugin/prvcat/fr" hreflang="fr">prvcat</a> qui permet de de mettre un mot de passe à des catégories entières. Même effet secondaire.</p>
<p>Wordpress propose à peu près ce que je voudrai mais là c'est dotclear.</p>
<p>Voici un exemple sur le blog d'<a href="http://www.jyreflechis.com" hreflang="fr">Emma</a>:
<img src="https://blog-du-grouik.tinad.fr/public/emma-mot-de-passe.jpg" alt="emma-mot-de-passe.jpg" style="display:block; margin:0 auto;" title="emma-mot-de-passe.jpg, nov. 2010" /></p>
<p>Dans l'ordre, il faudra:</p>
<ul>
<li>Différencier les billets protégés: avec le plugin mymeta</li>
<li>Adapter le template pour que par défaut il affiche le formulaire de mot de passe.</li>
<li>Un chouilla d'ajax pour remplacer ce formulaire par le contenu du billet suite à l'authentification.</li>
<li>Un plugin dotclear made by Gnieark qui sert à n'afficher que le contenu d'un billet (si mot de passe OK)</li>
</ul>
<h2>Différencier les billets à protéger par mot de passe.</h2>
<p>Pour savoir quels billets protéger par mot de passe, j'ai choisi d'utiliser le pluggin <a href="http://www.morefnu.org/category/dc2/plugins/Mymeta" hreflang="fr">Mymeta</a>.</p>
<p>Apres avoir installé le pluggin, j'ajoute une meta de type case à cocher nommée "limited_access".</p>
<p><a href="https://blog-du-grouik.tinad.fr/public/mymeta-case-cocher.jpg" title="mymeta-case-cocher.jpg"><img src="https://blog-du-grouik.tinad.fr/public/.mymeta-case-cocher_s.jpg" alt="mymeta-case-cocher.jpg" title="mymeta-case-cocher.jpg, nov. 2010" /></a><a href="https://blog-du-grouik.tinad.fr/public/mymeta-nouveau.jpg" title="mymeta-nouveau.jpg"><img src="https://blog-du-grouik.tinad.fr/public/.mymeta-nouveau_s.jpg" alt="mymeta-nouveau.jpg" title="mymeta-nouveau.jpg, nov. 2010" /></a></p>
<p>Dans l'interface de modification d'un billet ça se présente comme ça: Une case à cocher en dessous:
<img src="https://blog-du-grouik.tinad.fr/public/.meta-dotclear_m.jpg" alt="meta-dotclear.jpg" style="display:block; margin:0 auto;" title="meta-dotclear.jpg, nov. 2010" /></p>
<h2>Adapter le template</h2>
<p>Lorsqu'un billet a l'attribut mymeta de type limited_access égal à '1', on affiche le résumé, puis une zone de mot de passe.
les fichiers qui vont nous intéresser ce sont:</p>
<ul>
<li>category.html</li>
<li>home.html</li>
<li>post.html</li>
<li>tags.html</li>
</ul>
<p>(tous les fichiers qui affichent des billets en fait).</p>
<p>Tout se fait bien évidemment dans la boucle qui affiche les billets, généralement délimtée par <tpl:Entries> et </tpl:Entries></p>
<p>Ne collez pas le code qui suit, c'est juste pour montrer comment on utilise Mymeta dans le template:</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">/* Inclure ici le code qui affichera la boite de mot de passe*/</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">defined</span>=<span style="color: #ff0000;">"false"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">/* Inclure ici le code qui affichera le content d'un billet non protégé*/</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li></ol></pre>
<h3>Exemple pour post.html</h3>
<p>Ça se passe dans la partie <!\-\- # Entry with an excerpt \-\-> du fichier.
Les identifiants de la div contenu et du champs de mot de passe ont été mis pour le javascript (chapitre qui suit).</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;"><!-- # Entry with an excerpt --></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:EntryIf</span> <span style="color: #000066;">extended</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"post-excerpt"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryExcerpt}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:EntryIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"post-content"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"post-content{{tpl:EntryID}}"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"formpassword"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><h2<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang Password needed}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></h2<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><p<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang You must give a password to access this area.}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></p<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><p<span style="color: #000000; font-weight: bold;">></span></span><span style="color: #000000; font-weight: bold;"><label<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang Password:}} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"password"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"password_{{tpl:EntryID}}"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">tabindex</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000000; font-weight: bold;">/></span><span style="color: #000000; font-weight: bold;"></label<span style="color: #000000; font-weight: bold;">></span></span></span> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"submit"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"ok"</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"deverouille('{{tpl:EntryID}}');"</span>;<span style="color: #000000; font-weight: bold;">/></span><span style="color: #000000; font-weight: bold;"></p<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">defined</span>=<span style="color: #ff0000;">"false"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {{tpl:EntryContent}}</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div<span style="color: #000000; font-weight: bold;">></span></span></span></div></li></ol></pre>
<h3>Exemple pour les autres fichiers</h3>
<p>Dans category.html, home.html, tags.html contrairement à post.html, s'il y a une description, on n'affiche pas le billet en entier juste sa description.</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"post-content"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"post-content{{tpl:EntryID}}"</span><span style="color: #000000; font-weight: bold;">></span></span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #808080; font-style: italic;"><!-- # Entry with an excerpt --></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:EntryIf</span> <span style="color: #000066;">extended</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {{tpl:EntryExcerpt}}</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #808080; font-style: italic;"><!-- # acces limité; limited_access=1 (Mymeta) --></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"formpassword"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><h2<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang Password needed}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></h2<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><p<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang You must give a password to access this area.}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></p<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><p<span style="color: #000000; font-weight: bold;">></span></span><span style="color: #000000; font-weight: bold;"><label<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang Password:}} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"password"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"password_{{tpl:EntryID}}"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">tabindex</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000000; font-weight: bold;">/></span><span style="color: #000000; font-weight: bold;"></label<span style="color: #000000; font-weight: bold;">></span></span></span> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"submit"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"ok"</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"deverouille('{{tpl:EntryID}}');"</span>;<span style="color: #000000; font-weight: bold;">/></span><span style="color: #000000; font-weight: bold;"></p<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #808080; font-style: italic;"><!-- # acces llibre; limited_access=0 ou est null (Mymeta) --></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">defined</span>=<span style="color: #ff0000;">"false"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><p</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"read-it"</span><span style="color: #000000; font-weight: bold;">></span><span style="color: #000000; font-weight: bold;"><a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"{{tpl:EntryURL}}"</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"{{tpl:lang Continue reading}} {{tpl:EntryTitle encode_html="</span>1<span style="color: #ff0000;">"}}"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:lang Continue reading}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></a<span style="color: #000000; font-weight: bold;">></span></span></span>...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></p<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:EntryIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #808080; font-style: italic;"><!-- # Entry without excerpt --></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:EntryIf</span> <span style="color: #000066;">extended</span>=<span style="color: #ff0000;">"0"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #808080; font-style: italic;"><!-- # acces limité; limited_access=1 (Mymeta) --></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"formpassword"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><h2<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang Password needed}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></h2<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><p<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang You must give a password to access this area.}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></p<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><p<span style="color: #000000; font-weight: bold;">></span></span><span style="color: #000000; font-weight: bold;"><label<span style="color: #000000; font-weight: bold;">></span></span></span>{{tpl:lang Password:}} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"password"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"password_{{tpl:EntryID}}"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">tabindex</span>=<span style="color: #ff0000;">"1"</span> <span style="color: #000000; font-weight: bold;">/></span><span style="color: #000000; font-weight: bold;"></label<span style="color: #000000; font-weight: bold;">></span></span></span> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"submit"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"ok"</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"deverouille('{{tpl:EntryID}}');"</span>;<span style="color: #000000; font-weight: bold;">/></span><span style="color: #000000; font-weight: bold;"></p<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #808080; font-style: italic;"><!-- # acces llibre; limited_access=0 ou est null (Mymeta) --></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">defined</span>=<span style="color: #ff0000;">"false"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"post-contenu"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryContent}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:EntryIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div<span style="color: #000000; font-weight: bold;">></span></span></span></div></li></ol></pre>
<h3>Fichiers de template des flux</h3>
<h4>rss2.xml</h4>
<p>La modification se fait entre les balises <description>et </description></p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><description<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #ddbb00;">&lt;</span>p<span style="color: #ddbb00;">&gt;</span>Le contenu de ce billet est protégé par mot de passe. Rendez-vous sur le site pour le lire.<span style="color: #ddbb00;">&lt;</span>/p<span style="color: #ddbb00;">&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">defined</span>=<span style="color: #ff0000;">"false"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">{{tpl:EntryExcerpt absolute_urls="1" encode_xml="1"}}</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {{tpl:EntryContent absolute_urls="1" encode_xml="1"}}</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></description<span style="color: #000000; font-weight: bold;">></span></span></span></div></li></ol></pre>
<h4>atom.xml</h4>
<p>La modification se fait entre les balises <content type="html">et </content></p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"html"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #ddbb00;">&lt;</span>p<span style="color: #ddbb00;">&gt;</span>Le contenu de ce billet est protégé par mot de passe. Rendez-vous sur le site pour le lire.<span style="color: #ddbb00;">&lt;</span>/p<span style="color: #ddbb00;">&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tpl:MyMetaIf</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"limited_access"</span> <span style="color: #000066;">defined</span>=<span style="color: #ff0000;">"false"</span><span style="color: #000000; font-weight: bold;">></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {{tpl:EntryExcerpt absolute_urls="1" encode_xml="1"}}</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> {{tpl:EntryContent absolute_urls="1" encode_xml="1"}}</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tpl:MyMetaIf<span style="color: #000000; font-weight: bold;">></span></span></span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></content<span style="color: #000000; font-weight: bold;">></span></span></span></div></li></ol></pre>
<p>On est ok pour la partie html du template. En adaptant un peu le CSS, l'aperçu est en en-tête de ce billet.</p>
<h2>Le code javascript qui affichera le "content" du billet protégé</h2>
<p>Une fonction ajax qui appelle un script et rafraichit la div qui contient le contenu du billet.</p>
<p>A la source du dossier de template, je créée un fichier qui s'appelle password.js</p>
<p>Il contient:</p>
<pre class="javascript javascript" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #003366; font-weight: bold;">function</span> Ajx<span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #003366; font-weight: bold;">var</span> request <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">{</span>request <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">(</span><span style="color: #3366CC;">'Msxml2.XMLHTTP'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span style="color: #009900;">}</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">(</span>err2<span style="color: #009900;">)</span><span style="color: #009900;">{</span> <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">{</span>request <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">(</span><span style="color: #3366CC;">'Microsoft.XMLHTTP'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span style="color: #009900;">}</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">(</span>err3<span style="color: #009900;">)</span> <span style="color: #009900;">{</span><span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">{</span>request <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span style="color: #009900;">}</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">(</span>err1<span style="color: #009900;">)</span> <span style="color: #009900;">{</span>request <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #009900;">}</span><span style="color: #009900;">}</span><span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000066; font-weight: bold;">return</span> request<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #003366; font-weight: bold;">function</span> deverouille<span style="color: #009900;">(</span>postid<span style="color: #009900;">)</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #003366; font-weight: bold;">var</span> xhr <span style="color: #339933;">=</span> Ajx<span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> xhr.<span style="color: #660066;">onreadystatechange</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">(</span>xhr.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">4</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">(</span>xhr.<span style="color: #000066;">status</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">)</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">(</span>xhr.<span style="color: #660066;">responseText</span><span style="color: #339933;">==</span><span style="color: #3366CC;">"fail"</span><span style="color: #009900;">)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">(</span><span style="color: #3366CC;">'post-content'</span> <span style="color: #339933;">+</span> postid<span style="color: #009900;">)</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">(</span><span style="color: #3366CC;">'post-content'</span> <span style="color: #339933;">+</span> postid<span style="color: #009900;">)</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'<p>Erreur de mot de passe</p>'</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">(</span><span style="color: #3366CC;">'post-content'</span> <span style="color: #339933;">+</span> postid<span style="color: #009900;">)</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span>xhr.<span style="color: #660066;">responseText</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">(</span><span style="color: #3366CC;">'post-content'</span> <span style="color: #339933;">+</span> postid<span style="color: #009900;">)</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">"<font color=<span style="color: #000099; font-weight: bold;">\"</span>#FF0000<span style="color: #000099; font-weight: bold;">\"</span>>Error code "</span> <span style="color: #339933;">+</span> xhr.<span style="color: #000066;">status</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">"</font>"</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> <span style="color: #009900;">}</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> xhr.<span style="color: #000066;">open</span><span style="color: #009900;">(</span><span style="color: #3366CC;">"POST"</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'./index.php?justunpost/'</span> <span style="color: #339933;">+</span> postid<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> xhr.<span style="color: #660066;">setRequestHeader</span><span style="color: #009900;">(</span><span style="color: #3366CC;">"Content-Type"</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">"application/x-www-form-urlencoded"</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"> xhr.<span style="color: #660066;">send</span><span style="color: #009900;">(</span><span style="color: #3366CC;">"pass="</span> <span style="color: #339933;">+</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">(</span><span style="color: #3366CC;">'password_'</span> <span style="color: #339933;">+</span> postid<span style="color: #009900;">)</span>.<span style="color: #660066;">value</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> </div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">}</span></div></li></ol></pre>
<p>Dans le fichier de template _head.html, on ajoute le lien vers le nouveau script, juste apres </style>:</p>
<pre class="xml xml" style="font-family:inherit"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"{{tpl:BlogThemeURL}}/password.js"</span><span style="color: #000000; font-weight: bold;">></span><span style="color: #000000; font-weight: bold;"></script<span style="color: #000000; font-weight: bold;">></span></span></span></div></li></ol></pre>
<p>Le script fait la requete suivante pour réupérer le contenu (et uniquement le contenu, pas les header ni rien) :index.php?justunpost/' + postid où posid est l'identifiant du billet. On va donc créer un plugin dotclear qui retourne juste le contenu du billet, à condition que le mot de passe soit vérifié.</p>
<h2>Le plugin justunpost</h2>
<p>Mon premier plugin dotclear :D. Il est tout simple, mais comme je ne sais pas faire les plugins, ça m'a pris pas mal de temps.
Il sert à ce que l'URL http://www.domaine.com/index.php?justunpost/21 retourne le contenu du billet 21, à condition que la variable passée en POST ($_POST['pass']) corresponde au mot de passe.</p>
<p>Installez le tout simplement depuis le menu des extensions de dotclear.
<a href="https://blog-du-grouik.tinad.fr/public/justunpost.zip" hreflang="fr">Télécharger justunpost.zip</a></p>
<p>Il doit s'afficher dans la liste des extensions du panneau d'administration de dotclear. Allez y, pour définir un mot de passe.</p>
<p>C'est le mot de passe qu'il faudra rentrer au niveau du billet dans la partie publique du blog pour lire son contenu.</p>
<h2>Conclusion</h2>
<p>Normalement ça marche, je vais pouvoir lire la suite de l'histoire de la cigale et la fourmi.</p>
<h2>Limite de la méthode</h2>
<p>Comme le signale @PhilippeVay
Les ressources liées (photos etc....) ne sont pas protégées, on peut toujours y accéder directement par leur URL. Il n'y en aura pas sur le site en question, c'est pour ça que je le fais de cette façon.</p>
<p>Ps le site en <a href="http://rg2.tinad.fr" hreflang="fr">question est là</a></p>Le site rg2urn:md5:0d4c0444c53f605bccbd5b41755361832010-07-14T17:35:00+02:002010-07-14T17:07:03+02:00gniearkdev webdotclear <p>J'ai "livré"<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2010/07/14/Le-site-rg2#pnote-610-1" id="rev-pnote-610-1">1</a>]</sup> le site rg2. Traiter du contenu de ce dernier n'a pas beaucoup d'intérêt sur le blog du grouik.</p>
<p>Il n'est pas spécialement joli, parce que, je ne suis pas graphiste, et que le logotype. Bah, dur de décliner une palette de couleurs à partir de ça.</p>
<p>Même si ça peut paraitre ridicule je suis assez fier d'avoir réussi à adapter dotclear sans trop de difficultés (d'où ce billet).</p>
<p>Tout d'abord pourquoi dotclear?</p>
<ul>
<li>Je manque énormément de temps au travail, il ne fallait pas que ça me prenne plus de deux journées, hors de question de faire un site à partir de 0.</li>
<li>J'ai testé en premier Joomla, qui paraissait être le CMS le plus adapté au besoin. Je me suis aperçu que que c'est quand même dur à prendre en main, si je cramais deux jours à lire la doc, il ne me restait plus de temps dans le délai que je m'étais imparti.</li>
<li>Ayant récemment bien retapé ce blog, je commence à bien me sentir à l'aise dans les templates de dotclear.</li>
<li>Je maitrise un peu Spip, mais j'avais pas envie (et puis j'ai tenté de former des gens à spip, ça rebute pas mal sur l'interface de rédaction).</li>
</ul>
<p>Ce que le site rg2 a de particulier par rapport à un blog classique:
La page d'accueil contient le dernier billet (ou galerie) classée en Editorial. Puis la liste (pas le contenu) des autres billets dans l'ordre anti-chronologique. Et... c'est tout, mais j'en suis fier quand même :p</p>
<p>Lorsque j'ai créé le compte de l'utilisatrice principale, j'ai mis le format de rédaction xhtml par défaut. La première chose qu'elle a testé était de faire un copier collé depuis word d'un compte rendu de réunion. La mise en page n'a pas sauté. Et c'est bien agréable quand on cherche à "vendre" un site.</p>
<p><a href="http://rg2.tinad.fr" hreflang="fr"><img src="https://blog-du-grouik.tinad.fr/public/.rg2_m.jpg" alt="rg2.jpg" style="display:block; margin:0 auto;" title="rg2.jpg, juil. 2010" /></a></p>
<div class="footnotes"><h4>Notes</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2010/07/14/Le-site-rg2#rev-pnote-610-1" id="pnote-610-1">1</a>] Livré dans le sens où j'ai fait la passation de compétences à la nouvelle webmastrice. C'était cependant dans le cadre de mon activité salariée au centre hospitalier. Je n'ai pas facturé le bouzin.</p></div>
Avant quand je n'avais pas de blog,urn:md5:f31d718d827912faf3c6353053837a8e2010-06-27T17:27:00+02:002010-06-27T16:30:58+02:00gniearkVie (ou non) du sitedotcleartemplate <p>Avant quand je n'avais pas de blog, les petits pétages de plomb "je sature" concernaient mon appart. Je déplaçais les meubles à la recherche d'une disposition encore mieux (parfois à 2 heures du matin). Mais à Force de faire ça tous les 3 mois, j'ai trouvé la disposition optimisée de mon intérieur.</p>
<p>C'est pour ça que pour le bonheur des oreilles de mes voisins, depuis presque deux ans, je tiens ce blog,sur lequel je peux m’amuser à tout chambouler sans me péter le dos.
Un petit tour dans les CSS, dans les templates, sur gimp... Dotclear est sympa (comparé à wp ou joomla) pour aller bidouiller dedans.</p>
<p>Là ça devient pas mal.</p>Dotclear include dans les templatesurn:md5:9da261d29bcca1d908b50b24348a02d92010-04-27T12:59:00+02:002010-04-27T20:58:39+02:00gniearkdev webdotcleartemplate <p>Il existe une méthode pour se simplifier la vie lors de la création (ou adaptation) d'un template sous dotclear. Le morceau de code concernant juste le billet. On retrouve la même dans les fichiers suivants:</p>
<ul>
<li>category.html</li>
<li>post.html</li>
<li>tag.html</li>
<li>home.html</li>
<li>page.html</li>
<li>search.html</li>
</ul>
<p>Et ça me gonflait à chaque modification, juste sur la présentation du billet en lui même de devoir la répercuter dans tous ces fichiers.</p>
<p>La solution:
Se créer un fichier contenant le template partiel, juste le billet. Je l'ai nommé _justunpost.html
Puis on remplace ce qu'il y a entre <tpl:Entries> et <tpl:EntriesFooter> par <q>tpl:include src="https://blog-du-grouik.tinad.fr/post/2010/04/27/_justunpost.html"</q>. Comme ceci:</p>
<pre class="html"><span style="color: #009900;"><tpl:Entries></span>
{{tpl:include src="_justunpost.html"}}
<span style="color: #009900;"><tpl:EntriesFooter></span></pre>
<p>Quand à mon fichier _justunpost.html (personnalisé blog du grouik :p), il a cette tête là:</p>
<pre class="html"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"p{{tpl:EntryID}}"</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"post {{tpl:EntryIfOdd}} {{tpl:EntryIfFirst}}"</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:EntryLang}}"</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:EntryLang}}"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"post-title"</span><span style="color: #000000; font-weight: bold;">></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><a</span>
<span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:EntryURL}}"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryTitle encode_html="1"}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></a></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"post-info"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><table></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><tr></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><td</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"gncalendar"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><center></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><em</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"gndate"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryDate format="%A"}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></em></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
{{tpl:EntryDate format="%d %B"}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><em</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"gndate"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryDate format="%G"}} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></em></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
{{tpl:EntryTime}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></center></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></td></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><td</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"gninfos"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><center></span></span>Auteur:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span><span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><em</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"gndate"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryAuthorLink}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></em></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><tpl:EntryIf has_category<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span>
Cat<span style="color: #ddbb00;">&eacute;</span>gorie:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:EntryCategoryURL}}"</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"gndate"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryCategory encode_html="1"}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></a></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryIf></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></center></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></td></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><td</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"gntags"</span><span style="color: #000000; font-weight: bold;">></span></span>
Tags:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span><span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><tpl:EntryTags></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:TagURL}}"</span><span style="color: #000000; font-weight: bold;">></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"themes/aorakit-2D/images/tag.png"</span><span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:TagID}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></a></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryTags></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></td></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></tr></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></table></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div></span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;"><!-- # --BEHAVIOR-- publicEntryBeforeContent --></span></span>
{{tpl:SysBehavior behavior="publicEntryBeforeContent"}}
<span style="color: #009900;"><span style="color: #808080; font-style: italic;"><!-- # Entry with an excerpt --></span></span>
<span style="color: #009900;"><tpl:EntryIf extended<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"post-content"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryExcerpt}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span><span style="color: #ddbb00;">&nbsp;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><p</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"read-it"</span><span style="color: #000000; font-weight: bold;">></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:EntryURL}}"</span>
<span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:lang Continue reading}} {{tpl:EntryTitle encode_html="</span><span style="color: #cc66cc;">1</span><span style="color: #ff0000;">"}}"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:lang Continue
reading}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></a></span></span>...<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></p></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryIf></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;"><!-- # Entry without excerpt --></span></span>
<span style="color: #009900;"><tpl:EntryIf extended<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"0"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"post-content"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryContent}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><br</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span><span style="color: #ddbb00;">&nbsp;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryIf></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;"><!-- # --BEHAVIOR-- publicEntryAfterContent --></span></span>
{{tpl:SysBehavior behavior="publicEntryAfterContent"}}
<span style="color: #009900;"><span style="color: #808080; font-style: italic;"><!-- # Number of comments, trackbacks and attachments --></span></span>
<span style="color: #009900;"><tpl:EntryIf operator<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"or"</span> show_comments<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span> show_pings<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span> has_attachment<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"post-info-co"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"themes/aorakit-2D/images/comments.png"</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"icone commentaires"</span> <span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryIf></span>
<span style="color: #009900;"><tpl:EntryIf show_comments<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:EntryURL}}#comments"</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"comment_count"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryCommentCount}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></a></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryIf></span>
<span style="color: #009900;"><tpl:EntryIf show_pings<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:EntryURL}}#pings"</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"ping_count"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryPingCount}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></a></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryIf></span>
<span style="color: #009900;"><tpl:EntryIf has_attachment<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"{{tpl:EntryURL}}#attachments"</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">"attach_count"</span><span style="color: #000000; font-weight: bold;">></span></span>{{tpl:EntryAttachmentCount}}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></a></span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryIf></span>
<span style="color: #009900;"><tpl:EntryIf operator<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"or"</span> show_comments<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span> show_pings<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span> has_attachment<span style="color: #66cc66;">=</span><span style="color: #ff0000;">"1"</span><span style="color: #000000; font-weight: bold;">></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"><</span><span style="color: #66cc66;">/</span>tpl:EntryIf></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;"></div></span></span></pre>template du blog du grouik #2urn:md5:6323e8e965fe1a2d348bdbcd16f8da922010-04-22T18:01:00+02:002010-04-22T18:50:31+02:00gniearkVie (ou non) du sitedotclear <p>Crédit (même si au passage il faisait sa pub que j'ai censuré<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2010/04/21/template-du-blog-du-grouik-2#pnote-554-1" id="rev-pnote-554-1">1</a>]</sup>) et Franck (mon chef)<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2010/04/21/template-du-blog-du-grouik-2#pnote-554-2" id="rev-pnote-554-2">2</a>]</sup> m'ont dit que le Template était tristounet grossomodo.</p>
<p>Bon, j'ai rajouté des couleurs... maintenant il faut que je reprenne les éléments que j'avais déjà fait (le bandeau en haut et le terminal en fond des billets) pour les adapter à la palette. Je ne désespère pas, je vais y arriver à faire un truc qui pète. Mes contraintes:</p>
<ul>
<li>Mettre en valeur le texte, pas le décors. C'est un blog, pas un site vitrine pour un graphiste;)</li>
<li>Le thème est quand même principalement l'informatique,</li>
<li>Ça doit coller à ma personnalité, rêveur, un peu souillon, gniearkien</li>
<li>Ça ne doit pas rebuter le lecteur et être agréable.</li>
<li>Ça ne doit pas refléter mes névroses, mon coté sombre de personne qui arrache les ailes aux mouches, de pervers sociopathe etc... <sup>[<a href="https://blog-du-grouik.tinad.fr/post/2010/04/21/template-du-blog-du-grouik-2#pnote-554-3" id="rev-pnote-554-3">3</a>]</sup></li>
</ul>
<p>A part si au passage je trouve quelques tips and shits sur dotclear, je ne pense pas avoir l'occasion d'écrire un autre billet cette semaine (déplacement imprévu).</p>
<div class="footnotes"><h4>Notes</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2010/04/21/template-du-blog-du-grouik-2#rev-pnote-554-1" id="pnote-554-1">1</a>] g00gl3 est passé et a comptabilisé le lien pour ton PR ;), j'ai supprimé après</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2010/04/21/template-du-blog-du-grouik-2#rev-pnote-554-2" id="pnote-554-2">2</a>] Cher monsieur le directeur, bien évidemment, nous étions en dehors de nos heures de travail lors de cette discussion</p>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2010/04/21/template-du-blog-du-grouik-2#rev-pnote-554-3" id="pnote-554-3">3</a>] Je dois préciser que c'est une joke?</p></div>
Un template Dotclear perso pour le site du grouikurn:md5:080f06f24ba3e6a1b54f042ec869982a2010-04-18T17:50:00+02:002010-04-18T17:19:56+02:00gniearkVie (ou non) du sitedotclear <p>erf, c'est chronaphage en fait.
Je suis parti du template "vierge" aorakit-2D
<img src="https://blog-du-grouik.tinad.fr/public/blog_theme.php.jpeg" alt="blog_theme.php.jpeg" style="float:left; margin: 0 1em 1em 0;" title="blog_theme.php.jpeg, avr. 2010" /></p>
<p>Petits trucs que j'ai découvert, si ça peut resservir:<br />
_Tout d'abord, à l'installation d'un thème, les fichiers de template ne se trouvent pas physiquement dans le dossier Il faut les modifier une première fois via l'interface de dotclear pour qu'ils apparaissent dans le dossier themes/nom-du theme/tpl<sup>[<a href="https://blog-du-grouik.tinad.fr/post/2010/04/18/Un-template-perso-pour-le-site-du-grouik#pnote-551-1" id="rev-pnote-551-1">1</a>]</sup>. L'intéret pour moi était que gedit est plus ergonomique que l'interface d'édition.<br />
_Même méthode pour faire apparaitre des fichiers qui sont appelés à l'intérieur du template, dans ce genre: <q>tpl:include src="https://blog-du-grouik.tinad.fr/post/2010/04/18/_top.html"</q>. Si le fichier _top.html n'existe pas dans le dossier, dotclear prendra celui du thème parent d'après ce que j'ai pu lire. Sauf que du coup quand on l'édite ça ne marche pas, même apres un vidage du cache. La seule méthode est d'activer un autre theme, puis de réactiver le thème sur lequel on travaille.</p>
<p>Bon pour mon blog, je trouve ça relativement classe (même si comme je l'ai déjà dit, je n'ai pas vraiment la fibre du web design, ça reste gniearkien quoi). Je fignolerai au fur et à mesure.
Quand au respect des standards w3c pour le CSS et le code source HTML là... bah heu hum, j'ai un peu triché à des moments.</p>
<p>test sur les navigateurs:</p>
<ul>
<li>FF et Opéra OK.</li>
<li>Chrome : zut, faut que je reprenne ça.</li>
<li>IE, Je vous ai dit qu'il n'y a pas de microsoft chez moi?</li>
</ul>
<div class="footnotes"><h4>Notes</h4>
<p>[<a href="https://blog-du-grouik.tinad.fr/post/2010/04/18/Un-template-perso-pour-le-site-du-grouik#rev-pnote-551-1" id="pnote-551-1">1</a>] Ne me demandez pas où ils sont avant ça, je ne sais pas (je n'ai pas cherché).</p></div>
Dotclear ou Wordpressurn:md5:6f6a1127c8933260914aa928908303822010-03-29T18:50:00+02:002010-07-21T12:44:08+02:00gniearkServeurs http web et autresdotclearLogiciel-libre <p>Je ne vais pas mentir, j'ai installé ce blog il y a maintenant plus d'un an je crois sous DC, après un premier essai sous spip, plus par défaut, le premier truc que j'ai trouvé qui me paraissait sympathique.. Depuis, a cause d'Emma notamment, j'ai installé aussi des wordpress.
Je vais vous raconter mon ressenti.
Voyons les fonctionnalités, l'ergonomie puis les performances.</p>
<p>Au niveau des fonctionnalités, il n'y en a pas que je n'ai pas trouvé chez l'un mais pas chez l'autre. Cependant, sur les sites de tiers ayant développé des plugins, on trouve souvent une version wordpress et pas dotclear. J'ai toujours trouvé des adaptations sur le site de dotclear.
Match nul pour les fonctionnalités.</p>
<p>Wordpress parait plus user friendly au premier abord. Par défaut sous dotclear le mode de publication est le format "wiki". Il est cependant possible d'utiliser le format xhtml qui est un <a href="http://fr.wikipedia.org/wiki/What_you_see_is_what_you_get" hreflang="fr">WYSIWYG</a> Qui équivaut celui de son concurrent.
Conclusion, ce n'est qu'au premier abord (et perso je préfère la méthode wiki). Je conçois cependant que le format wiki par défaut puisse rebuter certains utilisateurs. Dotclear plus pour geek?
<img src="https://blog-du-grouik.tinad.fr/public/logo/.dcxhtml_m.jpg" alt="dcxhtml.jpg" style="display:block; margin:0 auto;" title="dcxhtml.jpg, mar. 2010" /></p>
<p>Regardons du coté des performances à présent.!!!!Serveur Web
C'est du ressenti, mais je trouve l'interface de wordpress un peu "molle" comparée à celle de mon cher blog. allons voir de plus prêt:
Je lance un top sur le serveur et je refresh la page d'accueil de ce blog:</p>
<pre>
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
13798 www-data 20 0 211m 18m 4136 S 4.7 0.9 0:01.76 apache2
13813 www-data 20 0 211m 18m 3904 S 0.7 0.9 0:01.44 apache2
2069 mysql 20 0 165m 51m 6460 S 0.3 2.6 5:21.07 mysqld
</pre>
<p>et je fais la même avec le site des défis d'écriture qui est sous wp:</p>
<pre>
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
13579 www-data 20 0 227m 36m 4252 S 33.3 1.8 0:05.22 apache2
13817 www-data 20 0 220m 28m 3764 S 23.3 1.4 0:00.70 apache2
2069 mysql 20 0 165m 51m 6460 S 0.3 2.6 5:21.17 mysqld
</pre>
<p>Ounch, pour le pourcentage de CPU utilisé en instantanné, il n'y a pas photo, DC est beaucoup plus léger.</p>
<p>Voila, ça c'est dit. Pour faire une vrai comparaison, il faudrait fouiner le code. Les templates sont gérés très différemment sur les deux systèmes. conclusion, perso, je continue sous dotclear (et si je change, ce sera pour tinadCMS)</p>