There is a method fetch () in smarty to get the content of the template page. Its declaration is like this :? Phpfunctionfetch ($ resource_name, $ cache_idnull, $ compile_idnull, $ displayfalse )? The first parameter is the Template Name, the second parameter is the cache id, the third parameter is the compilation id, and the fourth parameter is
There is a method fetch () in smarty to get the content of the template page. Its declaration is like this :? Php function fetch ($ resource_name, $ cache_id = null, $ compile_id = null, $ display = false )? The first parameter is the Template Name, the second parameter is the cache id, the third parameter is the compilation id, and the fourth parameter is
There is a method fetch () in smarty to get the content of the template page. Its declaration is like this:
function fetch($resource_name, $cache_id = null,
$compile_id = null, $display = false)
?>
The first parameter is the Template Name, the second parameter is the cache id, the third parameter is the compilation id, and the fourth parameter is whether to display the template content. this method is used to generate static pages.
$ Smarty = new Smarty ();
// Other template replacement syntax...
// The following sentence Retrieves all the content on the page. Note that the last parameter is false.
$ Content = $ smarty-> fetch ('template name. tpl', null, null, false );
// Write the content below to a static file
$ Fp = fopen('news.html ', 'w ');
Fwrite ($ fp, $ content );
Fclose ($ fp );
// OK. This news.html static page is generated here. You can handle your next step.
?>
You only need:
Code: Create table news ( Id int unsgined not null primary key auto_increment, Title varchar (255 ), Author varchar (50 ), Url varchar (100),/* Here is the address for generating static pages */ .../* Other fields */ ); ?>
|
After you extract the news address from the page, it will be OK .. Supplement: This URL is generated when the news is imported into the database. The specific process is as follows: 1. Enter the news content on the page and submit the form 2. Generate a URL by time or your custom format 3. concatenate SQL statements to write news content to the database. Note that the URL value must also be written to the database. 4. Obtain the template page content and generate a static page by URL The URL field does not automatically generate content... |