Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:cache:litemage:troubleshooting:uninitialized-php-vars-injected-block [2016/05/06 14:10] Michael Alegre created |
litespeed_wiki:cache:litemage:troubleshooting:uninitialized-php-vars-injected-block [2016/05/09 20:58] Long Hu |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Uninitialized PHP variables in injected blocks ====== | + | ====== Footer failed to output for SNS themes ====== |
- | Some customized themes may reference user initialized global PHP variables in injected blocks. When those ESI blocks render, null pointer errors will occur as those variables may have been initialized earlier but the injected block has no way of recognizing them. | + | **Problem**: The footer failed to output for SNS themes |
- | For example, for SNS themes: the footer template may fail to output due to the variable "$var_snstheme" actually being initialized in the header block. | + | **Cause**: The customized themes references user initialized global PHP variables in injected blocks. When those ESI blocks render, null pointer errors occurs as those variables has been initialized earlier but the injected block has no way of recognizing them. In SNS case here it is due to the variable "$var_snstheme" actually being initialized in the header block. |
- | Solution: Find the code where this variable is initialized copy this logic to the template of the injected block. For example, adding the following 2 lines: | + | **Solution**: Find the code where this variable is initialized, copy this logic to the template of the injected block. For example, adding the following 2 lines: |
<code> | <code> | ||
global $var_snstheme; | global $var_snstheme; | ||
Line 20: | Line 20: | ||
</code> | </code> | ||
- | Alternatively you can remove footer block injection. This however will slow down page loading time as well as increase cache size and is hence not recommended. | + | **Alternative Solution**: You can remove footer block injection. This however will slow down page loading time as well as increase cache size and is hence not recommended. |