Hello,
this post comes from a French topic :
L’onglet Snippet pour sauvegarder les documents.
The idea is to have information about snippets when we select them when editing documents.
In "mutate_content_dynamic", the loop "for" for the snippets becomes :
for ($i = 0; $i < $limit; $i++) {
$row=mysql_fetch_assoc($rs);
$matches=array();
$bmatches=array();
preg_match_all('/\/\/\s*(\[\[.*=.*)/',$row['snippet'],$matches);
preg_match_all('/\$(.*)=.*isset\(\$[^)_]*/',$row['snippet'],$bmatches);
echo "<option value='".$row['id']."'";
echo " onclick='$(\"snipexpl\").innerHTML=\"";
if(count($matches[1])==0) echo addslashes("pas d exemple pour ce snippet");
for($j=0;$j<count($matches[1]);$j++){
echo addslashes($matches[1][$j]);
echo "<br/>";
}
echo "\";";
echo "$(\"snipparam\").innerHTML=\"";
if(count($bmatches[1])==0) echo addslashes("pas de paramètres pour ce snippet");
for($j=0;$j<count($bmatches[1]);$j++){
echo "<span ";
echo "title=\\\"";
//echo "salut";
echo addslashes($bmatches[0][$j]);
echo "\\\"";
echo ">";
echo addslashes($bmatches[1][$j]);
echo "</span>";
echo "<br/>";
}
echo "\";'";
echo ">";
echo $row['name'];
echo "</option>";
}
Then the second "<td>" in the global table becomes:
<td valign="top">
<div class="tab-pane" id="snipMyPane" style="display:block">
<script type="text/javascript">
tpMyResources = new WebFXTabPane( document.getElementById( "snipMyPane" ) );
</script>
<div class="tab-page" id="tabExamSnip">
<h2 class="tab">Exemples du Snippet</h2>
<script type="text/javascript">tpMyResources.addTabPage( document.getElementById( "tabExamSnip" ) );</script>
<div id="snipexpl">Les exemples pour les snippets</div>
</div>
<div class="tab-page" id="tabParamSnip">
<h2 class="tab">Paramètres du Snippet</h2>
<script type="text/javascript">tpMyResources.addTabPage( document.getElementById( "tabParamSnip" ) );</script>
<div id="snipparam">Les paramètres des snippets</div>
</div>
</div>
</td>