root/releases/0.1.1b/units/templates/variables_substitute.php

Revision 5, 1.3 kB (checked in by sven, 3 years ago)

snapshot of elgg 0.1.1b

Line 
1 <?php
2
3     // Substitute variables in templates:
4     // where {{variablename}} is found in the template, this function is passed
5     // "variablename" and returns the proper variable
6
7         global $menubar;
8         global $metatags;
9         
10         $variables = $parameter[0];
11         $template_variable = $parameter[1];
12                 
13         if (isset($variables[$template_variable])) {
14             $run_result = $variables[$template_variable];
15         } else {
16             switch($template_variable) {
17                 
18                 case "menubar":            $run_result = $menubar;
19                                         break;
20                 case "url":                $run_result = url;
21                                         break;
22                 case "userfullname":    global $page_owner;
23                                         if (!isset($page_owner) || $page_owner == -1) {
24                                             $run_result = "";
25                                         } else {
26                                             $run_result = run("users:id_to_name", $page_owner);
27                                         }
28                                         break;
29                 case "metatags":
30                                         // $run_result = "<link href=\"/".$parameter[2].".css\" rel=\"stylesheet\" type=\"text/css\" />";
31                                         $run_result = "<style><!--\n";
32                                         $run_result .= run("templates:draw",array(
33                                                                                 'template' => $_SESSION['template_id'],
34                                                                                 'context' => 'css'
35                                                                                 )
36                                                                                 );
37                                         $run_result .= "// -->\n</style>\n";
38                                         $run_result .= $metatags;
39                                         break;
40                 
41             }
42         }
43
44 ?>
Note: See TracBrowser for help on using the browser.