admin管理员组

文章数量:1313178

It gives me blank page...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".dtd">
<html xmlns="">
<head>
{if $tplSeoFile}{include file="$modulePath/$tplSeoFile"}{/if}   
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Author" content="" />
<meta name="Robots" content="index, follow" />
<meta name="Revisit-after" content="10 days" />
<link rel="stylesheet" href="img/cms/css/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="img/cms/css/960.css" type="text/css" media="all" />
<link rel="stylesheet" href="img/cms/css/master.css" type="text/css" media="all" />
<script type="text/javascript" src=".3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {

    //Default Action
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
    $(".tab_content:first").show(); //Show first tab content

    //On Click Event
    $("ul.tabs li").click(function() {
        $("ul.tabs li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content
        var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active content
        return false;
    });

});
</script>


</head>

It gives me blank page...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3/1999/xhtml">
<head>
{if $tplSeoFile}{include file="$modulePath/$tplSeoFile"}{/if}   
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Author" content="" />
<meta name="Robots" content="index, follow" />
<meta name="Revisit-after" content="10 days" />
<link rel="stylesheet" href="img/cms/css/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="img/cms/css/960.css" type="text/css" media="all" />
<link rel="stylesheet" href="img/cms/css/master.css" type="text/css" media="all" />
<script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {

    //Default Action
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
    $(".tab_content:first").show(); //Show first tab content

    //On Click Event
    $("ul.tabs li").click(function() {
        $("ul.tabs li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content
        var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active content
        return false;
    });

});
</script>


</head>
Share Improve this question asked Feb 8, 2011 at 9:16 easyridereasyrider 7013 gold badges10 silver badges21 bronze badges 1
  • have you tried removing the script? does it load then? – cromestant Commented Feb 8, 2011 at 9:18
Add a ment  | 

3 Answers 3

Reset to default 4

You need to enclose it in {literal} tags otherwise smarty will try to interpret stuff within curly braces in your JavaScript code, leading to catastrophic failure and potentially a white page of death:

{literal}
<script>
$(document).ready(function() {

    //Default Action
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
    $(".tab_content:first").show(); //Show first tab content

    //On Click Event
    $("ul.tabs li").click(function() {
        $("ul.tabs li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content
        var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active content
        return false;
    });

});
</script>
{/literal}

See http://www.smarty/docsv2/en/language.function.literal.tpl

I'd rather use {literal}{/literal}, much easier.

A stated here you need to either take your code to an external JS script or make Jquery in noconflict mode! its quite simple, change $('') with jQuery('')

本文标签: phpWhat is wrong when I try to add jquery script to smarty tpl filesStack Overflow