1
sabahan
Division by Zero - xLanguage
  • 2011/9/18 3:59

  • sabahan

  • Quite a regular

  • Posts: 317

  • Since: 2006/3/4 5


my site is throwing random blank page in main page and certain module page..i have this error since long time ago..but only now reporting this here..

i thought it was my hoster server issue

i enabled debug ..this error is displayed

Quote:

Warning: Division by zero in file /home/portal_users/xxx/xxx_data/caches/smarty_compile/05d3d339-xlanguage-mytheme-default^%%D6^D6E^D6E59BDD%%db%3Axlanguage_block.html.php line 27
Warning: Division by zero in file /home/portal_users/xxx/xxx_data/caches/smarty_compile/05d3d339-xlanguage-mytheme-default^%%D6^D6E^D6E59BDD%%db%3Axlanguage_block.html.php line 27


this is line 27
<?php if ($this->_foreach['lang_it']['iteration'] % $this->_tpl_vars['block']['number'] == 0): ?>|<?php endif; ?>


this is the whole file xlanguage_block.html
<?php /* Smarty version 2.6.26, created on 2011-09-18 11:25:04
         compiled from db:xlanguage_block.html */ 
?>

<?php if ($this->_tpl_vars['block']['display'] == 'images' || $this->_tpl_vars['block']['display'] == 'text'): ?>
    <?php $_from $this->_tpl_vars['block']['languages']; if (!is_array($_from) && !is_object($_from)) { settype($_from'array'); }$this->_foreach['lang_it'] = array('total' => count($_from), 'iteration' => 0);
if (
$this->_foreach['lang_it']['total'] > 0):
    foreach (
$_from as $this->_tpl_vars['lang']):
        
$this->_foreach['lang_it']['iteration']++;
?>
        <a href="<?php echo $this->_tpl_vars['block']['url']; ?>
<?php 
echo $this->_tpl_vars['lang']['name']; ?>
" title="<?php echo $this->_tpl_vars['lang']['desc']; ?>
">
        <?php if ($this->_tpl_vars['block']['display'] == 'images'): ?>
            <img src="<?php echo $this->_tpl_vars['lang']['image']; ?>
" alt="<?php echo $this->_tpl_vars['lang']['desc']; ?>
"
            <?php if ($this->_tpl_vars['block']['selected'] != $this->_tpl_vars['lang']['name']): ?> 
                style="MozOpacity: .8; opacity: .8; filter:Alpha(opacity=80);"
            <?php endif; ?>
            />
        <?php else: ?>
        <?php echo $this->_tpl_vars['lang']['desc']; ?>

        <?php endif; ?>
        </a>
        <?php if ($this->_foreach['lang_it']['iteration'] % $this->_tpl_vars['block']['number'] == 0): ?>|<?php endif; ?>
    <?php endforeach; endif; unset($_from); ?>
<?php 
else: ?>
    <select name="selectlang"
            onChange="if(this.options[this.selectedIndex].value.length >0 )    { window.document.location=this.options[this.selectedIndex].value;}"
    >
    <?php $_from $this->_tpl_vars['block']['languages']; if (!is_array($_from) && !is_object($_from)) { settype($_from'array'); }$this->_foreach['lang_it'] = array('total' => count($_from), 'iteration' => 0);
if (
$this->_foreach['lang_it']['total'] > 0):
    foreach (
$_from as $this->_tpl_vars['lang']):
        
$this->_foreach['lang_it']['iteration']++;
?>
        <option value="<?php echo $this->_tpl_vars['block']['url']; ?>
<?php 
echo $this->_tpl_vars['lang']['name']; ?>

            <?php if ($this->_tpl_vars['block']['selected'] == $this->_tpl_vars['lang']['name']): ?>selected<?php endif; ?>
        ><?php echo $this->_tpl_vars['lang']['desc']; ?>
</option>
    <?php endforeach; endif; unset($_from); ?>
    </select>
<?php endif; ?>




How to fix this

Im using
Quote:

xlanguage 3.11
XOOPS Version XOOPS 2.5.2
PHP Version 5.3.6
mySQL Version 5.1.56
Server API cgi-fcgi
OS Linux
safe_mode Off
register_globals Off
magic_quotes_gpc On
allow_url_fopen Off
fsockopen On
post_max_size 8M
max_input_time 60
output_buffering
max_execution_time 30
memory_limit 32M
file_uploads On
upload_max_filesize 5M


2
trabis
Re: Division by Zero - xLanguage
  • 2011/9/18 11:21

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


in xlanguage_block.html try use this code:
<div style="text-align: center; margin-left: auto; margin-right: auto;">
<{if 
$block.display eq "images" OR $block.display eq "text"}>
    <{foreach 
item=lang name=lang_it from=$block.languages}>
        <
a href="<{$block.url}><{$lang.name}>" title="<{$lang.desc}>">
        <{if 
$block.display eq "images"}>
            <
img src="<{$lang.image}>" alt="<{$lang.desc}>"
            
<{if $block.selected != $lang.name}> 
                
style="MozOpacity: .8; opacity: .8; filter:Alpha(opacity=80);"
            
<{/if}>
            />
        <{else}>
        <{
$lang.desc}>
        <{/if}>
        </
a>
        <{if 
$block.number &&  $smarty.foreach.lang_it.iteration $block.number eq 0}>
        <
br />
        <{/if}>
    <{/foreach}>
<{else}>
    <
select name="selectlang"
            
onChange="if(this.options[this.selectedIndex].value.length >0 )    { window.document.location=this.options[this.selectedIndex].value;}"
    
>
    <{foreach 
item=lang name=lang_it from=$block.languages}>
        <
option value="<{$block.url}><{$lang.name}>" 
            
<{if $block.selected eq $lang.name}>selected<{/if}>
        ><{
$lang.desc}></option>
    <{/foreach}>
    </
select>
<{/if}>
</
div>


3
sabahan
Re: Division by Zero - xLanguage
  • 2011/9/18 11:42

  • sabahan

  • Quite a regular

  • Posts: 317

  • Since: 2006/3/4 5


the error notice is gone..

thank you trabis

i will monitor my website if there are any random blank page

im having this problem in two different website with two different hoster

TQ

Login

Who's Online

133 user(s) are online (71 user(s) are browsing Support Forums)


Members: 0


Guests: 133


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits