View previous topic :: View next topic |
Author |
Message |
dkova Smarty n00b
Joined: 03 Feb 2014 Posts: 2
|
Posted: Mon Feb 03, 2014 5:06 pm Post subject: Bootstrap JavaScript and Ajax (Pjax) don't work with Smarty |
|
|
Good day!
I write a PHP page with Smarty template engine and decided to use Bootstrap UI in my project (to be precise, Metro UI.
CSS works fine, but JavaScript doesn't work. I tried to use that without Smarty = all works excellent.
For example, hint:
index.tpl:
Code: | {config_load file="$tolangpath"}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>{#HomePageTitle#}</title>
{include file='libs.tpl'}
</head>
<body class="metro" style="background:url('./templates/images/bg-index.png') no-repeat;background-size:100%;">
<div style="text-align:right;padding-right:15px;">
<a href="#"
data-hint="Title|This is a hint for Me"
data-hint-position="top">
Hover me...
</a>
</div>
<div class="example" style="margin-left:35%;margin-top:10%;width:400px;">
<form action="./include/process/login.php">
<fieldset>
<img src="./templates/images/logo.png" align="center">
<label>{#Login#}</label>
<div class="input-control text" data-role="input-control">
<input name="login" type="text" placeholder="{#LoginInput#}">
<button tabindex="-1" class="btn-clear" type="button"></button>
</div>
<label>{#Password#}</label>
<div class="input-control password" data-role="input-control">
<input name="password" type="password" placeholder="{#PasswordInput#}">
<button tabindex="-1" class="btn-reveal" type="button"></button>
</div>
<div class="input-control checkbox" data-role="input-control">
<label>
<input type="checkbox" checked="">
<span class="check"></span>
{#RememberMe#}
</label>
</div>
<br>
<input type="submit" value="{#LoginButton#}">
<a class="button primary" href="./register" data-pjax="#main">{#RegisterButton#}</a>
<a class="button default" href="./recover">{#ForgotPassword#}</a>
</fieldset>
</form>
</div>
</body>
</html> |
libs.tpl:
Code: |
<link rel="stylesheet" href="./templates/css/metro-bootstrap.css">
<link rel="stylesheet" href="./templates/css/passProtect.css">
<script src="./templates/js/jquery-2.1.0.min.js"></script>
<script src="./templates/js/passProtect.js"></script>
<script src="./templates/js/jquery.widget.min.js"></script>
<script type="text/javascript" src="./templates/js/metro.min.js"></script>
<script type="text/javascript" src="./templates/js/jquery.pjax.js"></script>
<script type="text/javascript" src="./templates/js/metro-hint.js"></script>
<script type="text/javascript">
$(function(){
// pjax
$('ul a').pjax('#main')
})
</script>
|
Pjax (https://github.com/defunkt/jquery-pjax) doesn't work too. Please help to solve this problem.
P.S. Sorry for bad English |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
|
Back to top |
|
dkova Smarty n00b
Joined: 03 Feb 2014 Posts: 2
|
Posted: Tue Feb 04, 2014 10:45 am Post subject: |
|
|
But:
Quote: | Note: Smarty 3 no longer requires literal tags as long as the braces are surrounded by white space. |
|
|
Back to top |
|
Julian.Baker1 Smarty n00b
Joined: 15 Dec 2014 Posts: 4 Location: New York
|
Posted: Mon Dec 15, 2014 3:04 pm Post subject: Can't work it out |
|
|
I am new to this world and to Smarty and am trying to work around this problem myself. I went on the link shared, but I still can't figure it out. Could you please give a simpler explanation? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Dec 15, 2014 7:58 pm Post subject: |
|
|
Please explain the problem YOU are seeing. |
|
Back to top |
|
xhowiexo Smarty n00b
Joined: 21 Jan 2015 Posts: 1
|
Posted: Wed Jan 21, 2015 4:32 pm Post subject: |
|
|
tried?
{literal}
javascript
{/literal} |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sun Jan 25, 2015 4:13 am Post subject: |
|
|
dkova wrote: |
But:
Quote: | Note: Smarty 3 no longer requires literal tags as long as the braces are surrounded by white space. |
|
Correct, so your braces must be surrounded by white space. from your example:
Needs to be:
To work with Smarty 3 without literal tags. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Jan 25, 2015 9:01 am Post subject: |
|
|
mohrt wrote: | your braces must be surrounded by white space. from your example:
Needs to be:
To work with Smarty 3 without literal tags. |
Shouldn't it only check the whitespace inside braces? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Jan 29, 2015 7:30 pm Post subject: |
|
|
For auto literal the opening brace must be followed by a whitespace.
is a Smarty tag
is a literal |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jan 30, 2015 1:05 am Post subject: |
|
|
AnrDaemon wrote: | mohrt wrote: | your braces must be surrounded by white space. from your example:
Needs to be:
To work with Smarty 3 without literal tags. |
Shouldn't it only check the whitespace inside braces? |
afaik it needs to be surrounded by whitespace (or BOF), maybe uwe changed it to work either way, I haven't tested recently. |
|
Back to top |
|
|