-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
252 lines (212 loc) · 9.43 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?php
/**
* @package tpl_joomla_london
*
* @author Eoin <your@email.com>
* @copyright A copyright
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @link http://your.url.com
*/
defined('_JEXEC') or die;
use \Joomla\CMS\Factory;
$app = Factory::getApplication();
$doc = Factory::getDocument();
$user = Factory::getUser();
$this->language = $doc->language;
$this->direction = $doc->direction;
// Output as HTML5
$doc->setHtml5(true);
// Getting params from template
$params = $app->getTemplate(true)->params;
// Detecting Active Variables
$option = $app->input->getCmd('option', '');
$view = $app->input->getCmd('view', '');
$layout = $app->input->getCmd('layout', '');
$task = $app->input->getCmd('task', '');
$itemid = $app->input->getCmd('Itemid', '');
$sitename = $app->get('sitename');
$year = JFactory::getDate()->format('Y');
/* Component? */
$component = ($this->params->get('mainoutput'));
/* Add module positions */
$banners = ($this->countModules('banners'));
$debug = ($this->countModules('debug'));
$offcanvas = ($this->countModules('offcanvas'));
$header = ($this->countModules('header'));
$mainBanner = ($this->countModules('mainBanner'));
$belowBanner = ($this->countModules('belowBanner'));
$middle = ($this->countModules('middle'));
$bottom = ($this->countModules('bottom'));
$footer = ($this->countModules('footer'));
$belowFooter = ($this->countModules('belowFooter'));
// Make Columns // UNFINISHED I THINK
$rowClass = "row";
$colClass = "span";
$column_number = $params->get('column_number', 3);
$grid = 12;
$col_class_number = floor($grid/$column_number);
$columnClass = $colClass.$col_class_number;
$remainingCol = $grid - ($col_class_number * $column_number);
$counter = 1;
$total = count((array)$repeatable_fields);
// load scripts
// jQuery script from Joomla! load
JHTML :: _ ( 'jquery.framework');
// Load Boostrap via CDN or else fallback
// CSS
$doc->addStyleSheet('https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',array('integrity' => 'sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm', 'crossorigin' => 'anonymous'));
// JS
$doc->addScript('https://code.jquery.com/jquery-3.2.1.slim.min.js',array('integrity' => 'sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN', 'crossorigin' => 'anonymous'));
$doc->addScript('https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js',array('integrity' => 'sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q', 'crossorigin' => 'anonymous', 'defer' => 'defer'));
$doc->addScript('https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js',array('integrity' => 'sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl', 'crossorigin' => 'anonymous'));
unset($this->_scripts[$this->baseurl . '/media/jui/js/jquery-migrate.min.js']);
$this->setMetaData('viewport', 'width=device-width, initial-scale=1, shrink-to-fit=no');
// Avoids reusing $this->baseurl . templates . $this->template
$templateUrl = $this->baseurl . '/templates/' . $this->template;;
$templateName = "tpl_starter_bootstrap_4";
if (file_exists($templateUrl . '/css/template.css') && filesize($templateUrl . '/css/template.css') > 0)
{
$document = JFactory::getDocument();
$document->addStyleSheet($templateUrl . '/css/template.css', array('version' => 'auto'));
}
// Add JS. As above. Defer = true, Async = false.
if (file_exists($templateUrl . '/js/template.js') && filesize($templateUrl . '/js/template.js') > 0)
{
$document = JFactory::getDocument();
$document->addScript($templateUrl . '/js/template.js', "text/javascript", true, false, array('version' => 'auto'));
}
// Check for a custom CSS file
$userCss = $templateUrl . '/css/user.css';
if (file_exists($userCss) && filesize($userCss) > 0)
{
$document = JFactory::getDocument();
$document->addStyleSheet($userCss, array('version' => 'auto'));
}
?>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<jdoc:include type="head" />
</head>
<body <?php echo $option
. ' view-' . $view
. ($layout ? ' layout-' . $layout : ' no-layout')
. ($task ? ' task-' . $task : ' no-task')
. ($itemid ? ' itemid-' . $itemid : '')
. ($params->get('fluidContainer') ? ' fluid' : '');
echo($this->direction === 'rtl' ? ' rtl' : '');
?>">
<div id="tpl_bs4-wrapper">
<?php if ($offcanvas) : ?>
<div class="container">
<div class="row">
<section id="<?php echo "offCanvas" ?>">
<jdoc:include type="modules" name="offcanvas" style="bootstrap4" style="none" />
</section>
</div>
</div>
<?php endif ?>
<?php if ($header) : ?>
<div class="container">
<header id="<?php echo "header" ?>">
<div class="row">
<jdoc:include type="modules" name="header" style="bootstrap4" />
<?php if ($this->countModules('mainmenu')) : ?>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
data-target="#mainNavbar" aria-controls="mainNavbar" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainNavbar">
<jdoc:include type="modules" name="mainmenu" style="bootstrap4"/>
</div>
<?php endif; ?>
</div>
</header>
</div>
<?php endif ?>
<?php if ($mainBanner) : ?>
<div class="container">
<div class="row">
<section id="<?php echo "mainBanner" ?>">
<jdoc:include type="modules" name="mainBanner" style="bootstrap4" />
<a href="<?php echo JUri::base(true); ?>/">
<?php if ($this->params->get('sitedescription')) : ?>
<?php echo 'We call some params from the template, i.e. the description is: ' . '<div class="site-description">' . htmlspecialchars($this->params->get('sitedescription'), ENT_COMPAT, 'UTF-8') . '</div>'; ?>
<?php endif; ?>
</a>
</section>
</div>
</div>
<?php endif ?>
<?php if ($belowBanner) : ?>
<div class="container">
<div class="row">
<section id="<?php echo "belowBanner" ?>">
<jdoc:include type="modules" name="belowBanner" style="bootstrap4" />
</section>
</div>
</div>
<?php endif ?>
<?php if ($middle) : ?>
<div class="container">
<div class="row">
<section id="<?php echo "middle" ?>">
<?php if ($component == "1") : ?>
<div role="main">
<div class="container">
<div class="row">
<section id="<?php echo "component" ?>">
<jdoc:include type="message" />
<jdoc:include type="component" />
</section>
</div>
</div>
<?php endif ?>
<jdoc:include type="modules" name="middle" style="bootstrap4" />
</section>
</div>
</div>
<?php endif ?>
<?php if ($bottom) : ?>
<div class="container">
<div class="row">
<section id="<?php echo "bottom" ?>">
<jdoc:include type="modules" name="bottom" style="bootstrap4" />
</section>
</div>
</div>
<?php endif ?>
<?php if ($footer) : ?>
<div class="container">
<div class="row">
<section id="<?php echo "footer" ?>">
<jdoc:include type="modules" name="footer" style="bootstrap4" />
</section>
</div>
</div>
<?php endif ?>
<?php if ($belowFooter) : ?>
<div class="container">
<div class="row">
<section id="<?php echo "belowFooter" ?>">
<jdoc:include type="modules" name="belowFooter" style="bootstrap4" />
</section>
</div>
</div>
<p>
© <?php echo date('Y'); ?> <?php echo $sitename; ?>
</p>
<?php endif ?>
<?php if ($debug) : ?>
<div class="container">
<div class="row">
<section id="<?php echo "debug" ?>">
<jdoc:include type="modules" name="debug" style="bootstrap4" style="none" />
</section>
</div>
</div>
<?php endif ?>
</div>
</body>
</html>