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
6fa84f9d
Commit
6fa84f9d
authored
Nov 29, 2006
by
Penny Leach
Browse files
fixed some weird stuff in template parser
parent
4bf4a6eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/template.php
View file @
6fa84f9d
...
...
@@ -30,10 +30,9 @@ function template_parse($templatename) {
$t
=
array
();
$template
=
template_locate
(
$templatename
);
$template
=
$template
[
'fragment'
];
// we don't care about css or thumbnails right now
$fragment
=
file_get_contents
(
$template
);
$template
=
template_locate
(
$templatename
,
false
);
$fragment
=
file_get_contents
(
$template
[
'fragment'
]);
preg_match_all
(
'/(.*?)\{\{(.*?)\}\}/xms'
,
$fragment
,
$matches
,
PREG_SET_ORDER
);
...
...
@@ -59,7 +58,8 @@ function template_parse($templatename) {
$t
[]
=
$temp
;
return
$t
;
$template
[
'parseddata'
]
=
$t
;
return
$template
;
}
function
template_parse_block
(
$blockstr
)
{
...
...
@@ -86,7 +86,7 @@ function template_parse_block($blockstr) {
}
function
template_locate
(
$templatename
)
{
function
template_locate
(
$templatename
,
$fetchdb
=
true
)
{
// check dataroot first for custom templates
$templatedir
=
'templates/'
.
$templatename
.
'/'
;
...
...
@@ -108,6 +108,10 @@ function template_locate($templatename) {
break
;
}
}
$dbstuff
=
get_record
(
'template'
,
'name'
,
$templatename
);
$template
[
'cacheddata'
]
=
unserialize
(
$dbstuff
->
cacheddata
);
$template
[
'category'
]
=
$dbstuff
->
category
;
$template
[
'location'
]
=
get_config
(
'datarootroot'
)
.
'templates/'
.
$templatename
.
'/'
;
return
$template
;
}
...
...
@@ -122,6 +126,10 @@ function template_locate($templatename) {
break
;
}
}
$dbstuff
=
get_record
(
'template'
,
'name'
,
$templatename
);
$template
[
'cacheddata'
]
=
unserialize
(
$dbstuff
->
cacheddata
);
$template
[
'category'
]
=
$dbstuff
->
category
;
$template
[
'location'
]
=
get_config
(
'libroot'
)
.
'templates/'
.
$templatename
.
'/'
;
return
$template
;
}
...
...
Write
Preview
Markdown
is supported
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