Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
766c7551
Commit
766c7551
authored
Dec 01, 2006
by
Penny Leach
Browse files
beginnings of template render function
parent
9ffa72e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/template.php
View file @
766c7551
...
...
@@ -25,6 +25,8 @@
*/
defined
(
'INTERNAL'
)
||
die
();
define
(
'TEMPLATE_RENDER_READONLY'
,
1
);
define
(
'TEMPLATE_RENDER_EDITMODE'
,
2
);
function
template_parse
(
$templatename
)
{
...
...
@@ -143,5 +145,24 @@ function template_locate($templatename, $fetchdb=true) {
throw
new
InvalidArgumentException
(
"Invalid template name
$templatename
, couldn't find"
);
}
/**
* renders a template in either edit mode or read only mode
*
* @param array $template a parsed template see {@link template_parse}
* @param mode either TEMPLATE_RENDER_READONLY or TEMPLATE_RENDER_EDITMODE
*/
function
template_render
(
$template
,
$mode
)
{
$td
=
$template
[
'parseddata'
];
foreach
(
$td
as
$t
)
{
if
(
$t
[
'type'
]
==
'html'
)
{
echo
$t
[
'content'
];
}
else
{
// @todo call something depending on mode
}
}
}
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment