insert functionLOGIN

insert function

For example, if you use a template with an advertising banner position at the top of the page, the advertising banner can contain any mixed information such as HTML, images, FLASH, etc. Therefore, a static link cannot be used here, and we do not want the advertising banner to be cached. This requires specifying in the insert function: #banner_location_id# and #site_id# value (taken from the configuration file), and a function is required to obtain the content information of the advertising banner.

eg:

##{ insert name="getBanner" lid=#banner_location_id# sid=#site_id#}


Description: In this example, we use Use getBanner as the name attribute, and pass the two parameters #banner_location_id# and #site_id#.

Next Smarty searches your php program for a function named insert_getBanner(), #banner_location_id# and #site_id# The values ​​are combined into an array and passed to the function as the first parameter of the function. To avoid function naming confusion, all insert functions must start with insert_.

Your The insert_getBanner() function is executed based on the parameters passed and returns the results of the execution. These results are displayed in the template at the location where the function is called.

In this example Smarty Call this function like insert_getBanner(array("lid"=>"12345","sid"=>67890"));

and display the returned result in the calling Location.Next Section

<?php echo "insert函数";
submitReset Code
ChapterCourseware