Home > Backend Development > PHP Tutorial > Example of calling method of js in smarty, example of smartyjs calling_PHP tutorial

Example of calling method of js in smarty, example of smartyjs calling_PHP tutorial

WBOY
Release: 2016-07-13 10:15:50
Original
935 people have browsed it

Example of js calling method in smarty, smartyjs calling example

The example in this article describes the calling method of js in smarty and is shared with everyone for your reference. The specific method analysis is as follows:

1. Question:

Sometimes, in smarty, when js is included, the entire page will not be displayed, and programmers often find errors in the page. The program page and template page have been checked many times but there are no errors, which makes them very depressed.

2. Solution:

Copy the js code in the template page and put it in the new js file, and then include it in the template page, such as:

Copy code The code is as follows:
{popup_init src="css/commen.js"}

In this way, the problem is solved.

I hope this article will be helpful to everyone’s PHP programming design.

How to directly reference variables in smarty nested array in javascript

Smarty array calls do not need to use the ' symbol. To call smarty variables in js, you can assign values ​​in the original js code (must be in the page js code). Example:
{literal}

{/literal}
The smarty value call is generally: {$arr[135].value}. If the value you get is different, please check your code output. Smarty generally does not make mistakes. !

Interaction issues between smarty and js

Written in external JS, var abc=<{$row_array}> cannot be parsed into the correct value by smarty, which will cause JS syntax errors. If you need to use JS variables, you must write the variable part in the template file so that it can be parsed into the correct value

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/901283.htmlTechArticleExample of js calling method in smarty, smartyjs calling example This article describes the calling method of js in smarty, share it with For your reference. The specific method analysis is as follows: 1. Question:...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template