1 |
1546
|
Luisehahne
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* QuickSkin Extension load_file
|
4 |
|
|
* Print out file content
|
5 |
|
|
*
|
6 |
|
|
* Usage Example:
|
7 |
|
|
* External Content Source (counter.txt):
|
8 |
|
|
*
|
9 |
|
|
* 1234
|
10 |
|
|
*
|
11 |
|
|
* Template:
|
12 |
|
|
*
|
13 |
|
|
* You are visitor No: {load_file:"counter.txt"}
|
14 |
|
|
*
|
15 |
|
|
* Result:
|
16 |
|
|
*
|
17 |
|
|
* You are visitor No: 1234
|
18 |
|
|
*
|
19 |
|
|
* @author Andy Prevost andy@codeworxtech.com - original by Philipp v. Criegern philipp@criegern.de
|
20 |
|
|
*/
|
21 |
|
|
function qx_load_file ( $filename ) {
|
22 |
|
|
if (is_file($filename)) {
|
23 |
|
|
if($hd = @fopen($filename, 'r')) {
|
24 |
|
|
$content = fread($hd, filesize($filename));
|
25 |
|
|
fclose($hd);
|
26 |
|
|
return $content;
|
27 |
|
|
}
|
28 |
|
|
}
|
29 |
|
|
}
|