Re: cvs: smarty /docs/fr/programmers/advanced-features section-template-cache-handler-func.xml

Mehdi Achour <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <[email protected]>
Hi Gerald,

Can you please change the Revision comments when you update a file ?

Mehdi

Gerald Croes wrote:
> gerald		Fri Oct 29 07:58:17 2004 EDT
> 
>   Modified files:              
>     /smarty/docs/fr/programmers/advanced-features	
>                                                  	section-template-cache-handler-func.xml 
>   Log:
>   added CDATA, 
>   fixed variable-names
>   
>   
> http://cvs.php.net/diff.php/smarty/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml?r1=1.3&r2=1.4&ty=u
> Index: smarty/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml
> diff -u smarty/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml:1.3 smarty/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml:1.4
> --- smarty/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml:1.3	Sun May 23 12:32:19 2004
> +++ smarty/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml	Fri Oct 29 07:58:15 2004
> @@ -1,5 +1,5 @@
>  <?xml version="1.0" encoding="iso-8859-1"?>
> -<!-- $Revision: 1.3 $ -->
> +<!-- $Revision: 1.4 $ -->
>  <!-- EN-Revision: 1.1 Maintainer: nobody Status: partial -->
>  <sect1 id="section.template.cache.handler.func">
>   <title>Fonction de gestion du cache</title>
> @@ -26,8 +26,9 @@
>    </para>
>    <example>
>     <title>exemple d'utilisation de MySQL pour la source du cache</title>
> -<programlisting>
> -&lt;?php
> +   <programlisting>
> +    <![CDATA[
> + <?php
>  /*
>  
>  exemple d'usage :
> @@ -36,9 +37,9 @@
>  include('mysql_cache_handler.php');
>  
>  $smarty = new Smarty;
> -$smarty-&gt;cache_handler_func = 'mysql_cache_handler';
> +$smarty-i>cache_handler_func = 'mysql_cache_handler';
>  
> -$smarty-&gt;display('index.tpl');
> +$smarty->display('index.tpl');
>  
>  
>  la base mysql est attendu dans ce format :
> @@ -52,7 +53,7 @@
>  
>  */
>  
> -function mysql_cache_handler($action, &amp;$smarty_obj, &amp;$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null)
> +function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null)
>  {
>  	// l'h(te de la bd, l'utilisateur, et le mot de passe
>  	$db_host = 'localhost';
> @@ -65,7 +66,7 @@
>  	$CacheID = md5($tpl_file.$cache_id.$compile_id);
>  	
>  	if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
> -		$smarty_obj-&gt;_trigger_error_msg("cache_handler: could not connect to database");
> + $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
>  		return false;
>  	}
>  	mysql_select_db($db_name);
> @@ -75,21 +76,21 @@
>  			// récupère le cache dans la base de données
>  			$results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
>  			if(!$results) {
> -				$smarty_obj-&gt;_trigger_error_msg("cache_handler: query failed.");			
> +   $smarty_obj->_trigger_error_msg("cache_handler: query failed.");			
>  			}
>  			$row = mysql_fetch_array($results,MYSQL_ASSOC);
>  			
> -			if($use_gzip &amp;&amp; function_exists("gzuncompress")) {
> -				$cache_contents = gzuncompress($row["CacheContents"]);
> +			if($use_gzip && function_exists("gzuncompress")) {
> +				$cache_content = gzuncompress($row["CacheContents"]);
>  			} else {
> -				$cache_contents = $row["CacheContents"];
> +				$cache_content = $row["CacheContents"];
>  			}
>  			$return = $results;
>  			break;
>  		case 'write':
>  			// sauvegarde le cache dans la base de données
>  			
> -			if($use_gzip &amp;&amp; function_exists("gzcompress")) {
> +  	if($use_gzip && function_exists("gzcompress")) {
>  				// compresse le contenu pour gagner de la place
>  				$contents = gzcompress($cache_content);
>  			} else {
> @@ -100,26 +101,26 @@
>  							'".addslashes($contents)."')
>  						");
>  			if(!$results) {
> -				$smarty_obj-&gt;_trigger_error_msg("cache_handler: query failed.");			
> +   $smarty_obj->_trigger_error_msg("cache_handler: query failed.");			
>  			}
>  			$return = $results;
>  			break;
>  		case 'clear':
>           // efface les données du cache
> -			if(empty($cache_id) &amp;&amp; empty($compile_id) &amp;&amp; empty($tpl_file)) {
> +         if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
>  				// les efface toutes
>  				$results = mysql_query("delete from CACHE_PAGES");			
>  			} else {
>  				$results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");			
>  			}
>  			if(!$results) {
> -				$smarty_obj-&gt;_trigger_error_msg("cache_handler: query failed.");			
> +   $smarty_obj->_trigger_error_msg("cache_handler: query failed.");			
>  			}
>  			$return = $results;
>  			break;
>  		default:
>  			// erreur, action inconnue
> -			$smarty_obj-&gt;_trigger_error_msg("cache_handler: unknown action \"$action\"");
> +   $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
>  			$return = false;
>  			break;
>  	}
> @@ -128,7 +129,9 @@
>  	
>  }
>  
> -?&gt;</programlisting>
> +?>
> +]]>
> +</programlisting>
>    </example>
>   </sect1>
>   <!-- Keep this comment at the end of the file

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.