Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tcms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
tcms
Commits
e1b53a4e
Commit
e1b53a4e
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added HTML minifier and some comments.
parent
3bd59aff
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.php
+21
-12
21 additions, 12 deletions
index.php
templates/layout.tpl
+5
-0
5 additions, 0 deletions
templates/layout.tpl
with
26 additions
and
12 deletions
index.php
+
21
−
12
View file @
e1b53a4e
...
...
@@ -4,10 +4,12 @@
include_once
'pquery.config.php'
;
include_once
PQUERY_ROOT
.
'pquery.php'
;
// Config
__p
::
require_plugins
(
'template'
,
'sql'
,
'url'
,
'js'
,
'css'
);
__p
::
load_util
(
'minify_html'
,
'jshrink'
,
'CssParser'
);
__tpl
::
set_root
(
'templates'
);
// URL rewriting
__url
::
add_handlers
(
array
(
'css/(.*)'
=>
'css_handler'
,
'js/(.*)'
=>
'js_handler'
,
...
...
@@ -15,6 +17,7 @@ __url::add_handlers(array(
'(.*)'
=>
'content'
));
// Call content handler
header
(
'Vary: Accept-Encoding'
);
$handler
=
strstr
(
$_SERVER
[
'HTTP_ACCEPT_ENCODING'
],
'gzip'
)
!==
false
?
'ob_gzhandler'
:
''
;
...
...
@@ -23,11 +26,8 @@ ob_start($handler);
_url
(
$_SERVER
[
'QUERY_STRING'
])
->
handler
();
ob_end_flush
();
/**
*
*
* @param string $files One or more scripts separated by commas (',').
*/
// Cache handlers
function
js_handler
(
$files
)
{
$prepend_folder
=
create_function
(
'$x'
,
'return "js/$x";'
);
_js
(
array_map
(
$prepend_folder
,
explode
(
','
,
$files
)))
->
output
();
...
...
@@ -38,15 +38,13 @@ function css_handler($files) {
_css
(
array_map
(
$prepend_folder
,
explode
(
','
,
$files
)))
->
output
();
}
// HTML handlers
function
content
()
{
header
(
'Content-Type: text/html; charset=utf-8'
);
echo
'content'
;
html
(
'content'
);
}
function
layout
()
{
header
(
'Content-Type: text/html; charset=utf-8'
);
$menu
=
array
(
array
(
'Pagina\'s'
,
'pages'
),
array
(
'Nieuws'
,
'news'
),
...
...
@@ -63,7 +61,18 @@ function layout() {
$i
||
$item
->
set
(
'active'
,
'active'
);
}
echo
$layout
->
parse
();
html
(
$layout
->
parse
());
}
// HTML wrapper handler, minifies HTML and sets Content-Type header
function
html
(
$html
)
{
header
(
'Content-Type: text/html; charset=utf-8'
);
echo
Minify_HTML
::
minify
(
$html
,
array
(
'cssMinifier'
=>
'CssParser::minify'
,
'jsMinifier'
=>
'JShrink::minify'
));
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
templates/layout.tpl
+
5
−
0
View file @
e1b53a4e
...
...
@@ -2,8 +2,13 @@
<html>
<head>
<title>
Tcms
</title>
<meta
charset=
"utf-8"
/>
<meta
name=
"robots"
content=
"index,nofollow"
/>
<base
href=
"http://localhost/tcms/"
/>
<link
href=
"css/main"
rel=
"stylesheet"
/>
<script
async
type=
"text/javascript"
src=
"js/jquery-1.7.min,menu,list"
></script>
<!--
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment