Sujet fermé
Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5

<résolul>Menu seulement lorsque sous-page disponible
#1

Bonsoir,
Autre problème de menu. Je tente de refaire mon site, avec comme point de départ le nouveau thème Simplex.
Sur mon ancienne version, j'avais un menu qui s'affichait seulement s'il y a des sous-pages. D'ailleurs, le menu s'affiche correctement sur le site en production (1.11.2), donc ce n'est pas le code en tant que tel.
Toutefois, je suis incapable de le voir s'afficher sur mon nouveau site.


Code :
[== Indéfini ==]
Ancien gabarit
{capture assign="testvar"}{menu template='cssmenu' collapse='1' start_level="3" excludeprefix='intranet_'}{/capture}
{if isset($testvar) && $testvar != '' }
    <div id="droite_site"><div id="menu2">
      {$testvar}
       </div>
{/if}

Nouveau gabarit
        
{capture assign="testvar"}{menu template='cssmenu' collapse='1' start_level="3" excludeprefix='intranet_'}{/capture}
{if isset($testvar) && $testvar != '' }
            <aside class='sidebar grid_3'>{$testvar}
       </aside>
{/if}


J'ai une erreur dont je ne trouve pas la signification:

at line 806 in file /multimedia/sites/mlecms/lib/smarty/sysplugins/smarty_internal_templatebase.php:

Message:

Call of unknown method 'capture_error'.
Close Full Trace ↑
#0 /multimedia/sites/mlecms/tmp/templates_c/e929a2c9d74a66a5213b8a066517df683c2aaaa4.tpl_body.30.php(156): Smarty_Internal_TemplateBase->__call('capture_error', Array)
#1 /multimedia/sites/mlecms/tmp/templates_c/e929a2c9d74a66a5213b8a066517df683c2aaaa4.tpl_body.30.php(156): Smarty_CMS->capture_error()
#2 /multimedia/sites/mlecms/lib/smarty/sysplugins/smarty_internal_templatebase.php(180): content_50b02d9583fa47_47142489(Object(Smarty_Internal_Template))
#3 /multimedia/sites/mlecms/lib/classes/class.Smarty_CMS.php(319): Smarty_Internal_TemplateBase->fetch('tpl_body:30', 'p213', NULL, NULL, false, false, false)
#4 /multimedia/sites/mlecms/index.php(235): Smarty_CMS->fetch('tpl_body:30')
#5 {main}

Quelqu'un pourrait m'aider à y voir clair?
Merci.
Mel


Citation :#~~~~~ DEBUT BLOC A NE PAS SUPPRIMER ~~~~~
#~ Version du CMS: 1.11.3
#~ Url du site :
#~ Hébergeur / Soft :
#~ Informations Système :
#~ ----------------------------------------------
#~ Cms Version: 1.11.3
#~ Installed Modules:
#~ CGExtensions: 1.31.1
#~ CMSMailer: 5.2.1
#~ CMSPrinting: 1.0.3
#~ ContentCache: 1.2
#~ FileManager: 1.4.2
#~ GBFilePicker: 1.3.2
#~ JQueryTools: 1.1.1
#~ MenuManager: 1.8.4
#~ MicroTiny: 1.2.4
#~ MleCMS: 1.11.3
#~ FrontEndUsers: 1.20
#~ ModuleManager: 1.5.5
#~ News: 2.12.10
#~ Search: 1.7.7
#~ ThemeManager: 1.1.7
#~ MysqlDump: 1.2.4
#~ CGContentUtils: 1.3.3
#~ LightBox: 1.0.1
#~ CGFeedMaker: 1.0.17
#~ Glossary: 0.10
#~ CustomContent: 1.8.3
#~ SimpleMagpieRSS: 1.2.5.1
#~ FormBuilder: 0.7.3
#~ TinyMCE: 2.9.11
#~ ExtendedTools: 1.3.3
#~ Config Information:
#~ php_memory_limit:
#~ process_whole_template:
#~ output_compression:
#~ max_upload_size: 16000000
#~ url_rewriting: mod_rewrite
#~ page_extension:
#~ query_var: page
#~ image_manipulation_prog: GD
#~ auto_alias_content: true
#~ locale:
#~ default_encoding: utf-8
#~ admin_encoding: utf-8
#~ set_names: true
#~ Php Information:
#~ phpversion: 5.3.10-1ubuntu3.4
#~ md5_function: On (Vrai)
#~ gd_version: 2
#~ tempnam_function: On (Vrai)
#~ magic_quotes_runtime: Off (Faux)
#~ E_STRICT: 0
#~ E_DEPRECATED: 0
#~ memory_limit: 128M
#~ max_execution_time: 30
#~ output_buffering: 4096
#~ safe_mode: Off (Faux)
#~ file_uploads: On (Vrai)
#~ post_max_size: 16M
#~ upload_max_filesize: 16M
#~ session_save_path: /var/lib/php5 (1733)
#~ session_use_cookies: On (Vrai)
#~ xml_function: On (Vrai)
#~ xmlreader_class: On (Vrai)
#~ Server Information:
#~ Server Api: apache2handler
#~ Server Db Type: MySQL (mysql)
#~ Server Db Version: 5.5.28
#~ Server Db Grants: Trouvé un privilège "GRANT ALL" qui semble être adapté
#~ ----------------------------------------------
#~~~~~ FIN BLOC A NE PAS SUPPRIMER ~~~~~
#2

Il semble qu'il trouve une erreur à l'appel d'un {capture} lors du traitement du body.
Tu peux regarder de quelle capture il s'agit en étudiant la fin du tmp/templates_c/e929a2c9d74a66a5213b8a066517df683c2aaaa4.tpl_body.30.php
#3

Malheureusement je n'y comprends pas grand chose. J'ai beau cherché sur google, je ne trouve pas de cas semblables.
Code :
[== Indéfini ==]
<?php $_smarty_tpl->_capture_stack[0][] = array('default', "testvar", null); ob_start(); ?><?php echo smarty_cms_function_menu(array('template'=>'cssmenu','collapse'=>'1','start_level'=>"3",'excludeprefix'=>'intranet_'),$_smarty_tpl);?>
<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
<?php if (isset($_smarty_tpl->tpl_vars['testvar']->value)&&$_smarty_tpl->tpl_vars['testvar']->value!=''){?>
            <aside class='sidebar grid_3'><?php echo $_smarty_tpl->tpl_vars['testvar']->value;?>

       </aside>
<?php }?>
#4

Ton erreur est d'avoir laissé une espace avant la fermeture de l'accolade :
{if isset($testvar) && $testvar != '' }
doit être
{if isset($testvar) && $testvar != ''}
Smarty 3 est devenu intraitable à ce sujet.
#5

Bonsoir,
Merci, mais ce n'est pas le problème. Comme je l'avais mentionné, mon code fonctionnait dans mon autre gabarit.
Je viens de faire des tests, et l'erreur ne se produit pas si je mets ce bout de code dans la partie "header". Nul part ailleurs (après content, dans footer) ne fonctionne - toujours la même erreur.
Je mets mon gabarit, si jamais qqn peut m'aider à y comprendre.
Merci encore.


Code :
[== Indéfini ==]
{capture name="menu" assign="testvar"}{menu template='cssmenu' collapse='1' start_level='3' excludeprefix='intranet_'}{/capture}
{if isset($testvar) && $testvar != ''}
            <nav class='sidebar'>
                      {$testvar}
</nav>
    
{/if}


Code :
[== HTML ==]
{strip}
{MleCMS action="init"}{process_pagedata}

{* With cms_lang_info we retrieve current language information, assign gives us $nls variable we can work with *}
{cms_lang_info assign='nls'}

{* using strip as we don't want useless whitespace, especially not before doctype *}
{/strip}<!doctype html>
<html lang="{$lang_parent}">
<head>
<meta charset='{$nls->encoding()}'>
<title>{title} - {sitename}</title>
<meta name='viewport' content='initial-scale=1.0 maximum-scale=1.0 user-scalable=no' />
<meta name='HandheldFriendly' content='true' />
{* Don't remove this! Metadata is entered in Site Admin/Global settings. *}
{metadata}
{* See in news detail template how cannonical url can be assigned from module *}
{if isset($canonical)}<link rel='canonical' href='{$canonical}' />{elseif isset($content_obj)}<link rel='canonical' href='{$content_obj->GetURL()}' />{/if}
{* This is how all the stylesheets attached to this template are linked to *}
{cms_stylesheet}
{* using google fonts *}
<link href='//fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'>
{* learning IE lower then Version 9 some html5 *}
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{* Relational links for interconnections between pages, good for accessibility and Search Engine Optmization *}
{cms_selflink dir='start' rellink='1'}
{cms_selflink dir='prev' rellink='1'}
{cms_selflink dir='next' rellink='1'}
</head>
<body id='boxed'>
<!-- #wrapper (wrapping content in a box) -->
<div class='container centered' id='wrapper'>
    <!-- accessibility links, jump to nav or content -->
    <ul class="visuallyhidden">
        <li>{anchor anchor='nav' title='Skip to navigation' accesskey='n' text='Skip to navigation'}</li>
        <li>{anchor anchor='main' title='Skip to content' accesskey='s' text='Skip to content'}</li>
    </ul>
    <!-- accessibility //-->
     <!-- .top (top section of page containing logo, navigation search...) -->
      <header class='top'>
        <div class='row header'>
            
            {strip}
                {search assign='is_search'}{* assigned search module tag, now we can build different search template for this site template and have fun with html5, Read http://www.w3.org/TR/html-markup/input.search.html for full attirbute specs *}
                {if isset($is_search)}
                <div class='grid_2 suffix_2 search noprint' role='search'>
                        {$startform}
                        <label for='{$search_actionid}searchinput' class='visuallyhidden'>{$searchprompt}:</label>
                            <input type='search' class='search-input' id='{$search_actionid}searchinput' name='{$search_actionid}searchinput' size='20' maxlength='50' value='' placeholder='{$searchtext}' />
                            {if isset($hidden)}{$hidden}{/if}
                        {$endform}
                </div>
                {/if}{/strip}
          
  <!-- .main-navigation (main navigation on the right side) -->
            <nav class='main-navigation grid_8 noprint' id='nav' role='navigation'>
                {menu template='Simplex_Navigation.tpl' show_root_siblings="1" excludeprefix="intranet_" childrenof=$lang_parent}
            </nav>
            <!-- .main-navigation //-->
         </div>
        <div class='clear'></div>    
        <!-- .header-bottom //-->
        <!-- .banner (banner area for a slider or teaser image) -->
      
<section class='banner row noprint' role='banner'>

<div class='banner-text'>
             <div class='logo'>{cms_selflink dir="start" text="$sitename" page=$lang_parent}{MleCMS name="snippet_sitename"}{MleCMS action='langs' template="Separator"}</div>  
             </div>
<div class='banner-image cf'>
                                
{strip}
                {* you do not need a module for every simple site functionality. For example you can build a simple slideshow
                with php glob function (http://www.php.net/manual/en/function.glob.php) without wasting your system resources
                by using modules or plugins.
                Below would search for files matching .jpg in folder named teaser in simplex theme folder *}
                {assign var='teaser' value='uploads/simplex/teaser/*.jpg'|glob}
                    {foreach from=$teaser item='one'}
                        <div><div class='sitename'>{MleCMS name="snippet_sitename"}</div>  <img src='{root_url}/{$one}' width='852' height='150' alt='' />  </div>
                    {/foreach}
            {/strip}
                </div>              
        </section>
</header>

    <!-- .top //-->
    <!-- .content-wrapper (wrapping div for content area) -->
    <div class='content-wrapper cf'>
        <!-- .content (display content first) -->
        <div class='content-inner'>
            <!-- .content-top (breadcrumbs and print button) -->
    <div class='content-top cf' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'>            
                {* menu manager has action breadcrumbs since 1.11, you can use {cms_breadcrumbs} tag or {menu action='breadcrumbs'} as below *}
                <div class='grid_5'>{menu action='breadcrumbs'}</div>                
                {* print tag from CMSPrinting Module *}
               <div id='sharing' class='grid_5'>
                {translate text="Partager"}: {socialBookmarking submitto="email|facebook|twitter|linkedin" plusone="1" img_size="small" url="1"}
               {translate text="Traduire"}: {socialBookmarking submitto="googletranslate" img_size="small" url="1"}
               </div>
              <div class="grid_2">{print showbutton='false' class='printbutton noprint'}</div>
  
        </div>
        
      <!-- .content-top //-->
            <!-- .content (actual content with title and content tags) -->
     <article class='content' id='main' role='main'>
                  <h1 class='grid_10 push_1'>{title}</h1> {* title tag *}  
                {content_image block='logo' dir='images/icone' class='grid_1 pull_10'}
{* logo de chaque page *}

          

<div class='clear'></div>
{content}
               </article>
            <!-- .content //-->
        </div>
        <!-- .content-inner //-->

        <div class='cf grid_8 prefix_4'>
            <span class='previous'>{cms_selflink dir='previous'}</span>
            <span class='next'>{cms_selflink dir='next'}</span>
        </div>
    </div>
    <!-- .content-wrapper //-->
    <!-- .footer (footer area) -->
    <footer class='row footer'>
        <span class='back-top'>{anchor anchor='main' text='&uarr;'}</span>
        <section class='grid_4 copyright'>
            <ul class='social cf'>
                <li class='twitter'><a title='Twitter' href='http://twitter.com/#!/cmsms'>Twitter</a></li>              
                <li class='linkedin'><a title='LinkedIn' href='http://www.linkedin.com/groups?gid=1139537'>LinkedIn</a></li>
<li class='rss'> {CGFeedMaker action='rsslink' feed='{translate text="annonces"}' image='uploads/images/cms/rss.png' imageonly='1'}</li>
</ul>
                {MleCMS name='block_pied'}
            
        </section>
        <section class='grid_8 noprint'>
            <nav class='footer-navigation row'>
                {MleCMS name='block_menu_pied'}            
            </nav>
        </section>
</footer>
    <div class='clear'></div>
</div>
<!-- #wrapper //-->
{cms_jquery cdn=true exclude='jquery-ui.min.js,jquery.ui.nestedSortable.js,jquery.json.min.js' append='uploads/simplex/js/functions.min.js'}
{global_content name='accordion'}
{global_content name='analytics'}
</body>
</html>
#6

Écris alors ton gabarit ainsi :
Code :
{strip}{capture name="menu" assign="testvar"}{menu template='cssmenu' collapse='1' start_level='3' excludeprefix='intranet_'}
{/capture}{MleCMS action="init"}{process_pagedata}{cms_lang_info assign='nls'}{/strip}<!doctype html>
Et appelle
Code :
{if isset($testvar) && $testvar != ''}<nav class='sidebar'>{$testvar}</nav>{/if}
où tu le désires.
#7

Pour ton gabarit à lire peut être - Modification thème Simplex : correction de

J-C Etiemble v 2.2.xx
Sujet fermé


Atteindre :


Utilisateur(s) parcourant ce sujet : 2 visiteur(s)