2013年8月24日 星期六

Resolved: Smarty + jquery

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template &quot;.\templates\common\master.tpl&quot; on line 43 &quot;(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){&quot; - Unexpected &quot;[&quot;, expected one of: &quot;}&quot; , &quot; &quot; , ATTR' in D:\xampp\htdocs\smarty\sysplugins\smarty_internal_templatecompilerbase.php:667 Stack trace: #0 D:\xampp\htdocs\smarty\sysplugins\smarty_internal_templateparser.php(3144): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 D:\xampp\htdocs\smarty\sysplugins\smarty_internal_templateparser.php(3209): Smarty_Internal_Templateparser->yy_syntax_error(64, '[') #2 D:\xampp\htdocs\smarty\sysplugins\smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(64, '[') #3 D:\xampp\htdocs\smarty\sysplugins\smarty_internal_templatecompilerbase.php(206): Smarty_Internal_SmartyTemplateCompiler->doCompile('??<!DOCTYPE HTM...') #4 D:\xampp\htdocs\smarty\sysplugins\smarty_inter inD:\xampp\htdocs\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 667



Solution

<script>
{literal}
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-40401063-1', 'bbgaga.com');
  ga('send', 'pageview');
{/literal}
</script>

Resolved: Missing Content in Node and Panel [Drupal 6 Migrate from PHP 5.3 to 5.4]

After migrating php from 5.3 to 5.4, content in the node and panel becomes missing.

Solution:
Edit the file panels.module
function template_preprocess_panels_pane($vars) {
 -->
function template_preprocess_panels_pane(&$vars) { 

2013年4月9日 星期二

Avoid adding white space at the top of the page when using php include

I've written a simple php include today and place the header information in it..

header.inc.php
<div>some text in header bar</div>

index.php
<html>
...
<body>
<?php include_once('/include/header/header.inc.php'); ?>
....

When I ran the page and found that there are empty spaces at the top of my header text.. Checked with different version of browser, the spaces could only be found in firefox and chrome, whereas IE shows perfectly in the screen.

Inspect the element in chrome, there are some white space added at the top of the page..

Solution
The problem was caused by the BOM header in the php file and could be solved by changing the encoding to "Encode in UTF-8 without BOM"


2013年4月7日 星期日

PHP enable tag


Installed a new server with apache and deployed a php application to it..
When running the php code, the page returns <?=$var1?> instead of showing the value of the variable $var1.

It is due to the configuration in php.ini... short_open_tag is set to be "Off" by default.
short_open_tag=on

 
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.