integers, floating-point numbers to floating-point or scientific notation (more than 6 digits in scientific notation), and format them to a specified location (if scientific counts are e;)
G, auto-adjust convert integers, floating-point numbers to floating-point or scientific notation (more than 6 digits in scientific notation), and format them to a specified location (if scientific counts are e;)
%, when there is a format flag in the string, a percent sign is required
Note:
in the Smarty format.
The following example shows how to use the custom variable mediation in Smarty.
Program idea: it is used as a variable mediation device to convert text and intercept text.
Init. inc. php (Smarty initialization file)
Define ('root _ path', dirname (_ FILE _); // you can specify the ROOT directory of a website.
Require ROOT_PATH. '/libs/Smarty. class. php'; // load the Smarty template engine
$ _ Tpl = new Smarty (); // Create
The framework is mainly used to implement collaborative development among multiple programmers and implement the mvc development mode. skymvc adopts the mvc development mode, and the framework itself is easy to expand. As the basic framework of skymvc's Skynet program, adhering to the excellent tradition of easy to use, easy to learn, and joint development, we are committed to creating an excellent php
Mvc framework. You are welcome to give more suggestions.
1. Create the configuration file skyM
so that it has the write permission.
For the sake of system security and portability, we recommend that you do not create these directories in the same directory of the PHP Execution program. You can create these directories in addition to the PHP Execution program directory, if you have already created a PHP Execution program in the same directory, you can use Apache to restrict access to directories.
2. Create related configuration files
We need to create a configuration file to overwrite the
I made a page for the data transfer problem between the smarty template and php, and used the smarty template. The data is read in index. php and displayed in the index. tpl file. However, the tpl file has a button to sort the data in the specified order. For example, in index. php, the read sequence from the database is 1, 2, 3, and 4 by default. There is a button in the
directory of the PHP execution program. You can also use your custom cache handler to control cached files, which will ignore this setting. Similarly, if you create this directory on a Linux server, you also need to modify the directory permission so that it has the write permission.
For the sake of system security and portability, we recommend that you do not create these directories in the same directory of the PHP execution program. you can create these directories in addition to the PHP exe
need to create a configuration file to overwrite the default member attributes of the PHP template Smarty class and name it main. php, saved in the smarty directory, which script needs to use Smarty in the future, we just need to put main. include php.
include("./smarty/libs/Smarty.class.php");
define('SMARTY_ROOT', './smarty/tpls');
$tpl = new Smarty();
$tpl->template_dir = SMARTY_ROOT
= new dojox.dtl.Context( {foo: "foo", bar: "bar", get: function(key){ return key + "TEST"; }}); var tpl = new dojox.dtl.Template("{{ foo }}-{{ bar }}"); t.is("fooTEST-barTEST", tpl.render(context));
Here we initialize a context object and define its "get" method. Then we use this object to "fill" the template we created. Here, "{Foo}" and "{bar}" represent the "foo" and "bar" variables, so the final return value is "footest-bartest ". This is th
This is a program that I wrote to list all the shopping carts, and you can rewrite them as needed.
Ob_start ();
Session_Start ();
/*
$s =array ("id" => 6, "name" => "Test A", "Price" => "6", "Count" =>3);
$t =array ("id" => 7, "name" => "Test B", "Price" => "7", "Count" =>15);
$u =array ("id" => 8, "name" => "Test C", "Price" => "8", "Count" =>21);
$rst =array ($s, $t, $u);
*/
Require_once ("html/it.php");
$TPL = new Html_template_it ("./");
Reading
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.