Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Websites
/
SlimSpots Wiki
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 3afad25c
authored
2015-02-05 13:01:38 +0100
by
Aleksandar Hristov
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
sidebar menu
1 parent
b9b138e7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
3 deletions
html/global_functions.php
html/index.php
html/tpl/user_sidebar_wrapper.tpl
html/global_functions.php
View file @
3afad25
...
@@ -24,6 +24,20 @@ function get_pages()
...
@@ -24,6 +24,20 @@ function get_pages()
return
$db_page_title
;
return
$db_page_title
;
}
}
//function that returns all the page id's in the database in an array
function
get_pages_id
()
{
global
$db
;
$i
=
0
;
$query
=
$db
->
query
(
"SELECT * FROM pages"
);
while
(
$row
=
$query
->
fetchArray
())
{
$pages_id
[
$i
]
=
$row
[
0
];
$i
++
;
}
return
$pages_id
;
}
//function that returns all the sections in the database in an array in format "page: section"
//function that returns all the sections in the database in an array in format "page: section"
function
get_sections
()
function
get_sections
()
{
{
...
@@ -66,7 +80,7 @@ function current_page()
...
@@ -66,7 +80,7 @@ function current_page()
return
$current_page
;
return
$current_page
;
}
}
//function that returns all the sections that belong to a specific page
//function that returns all the sections t
itles t
hat belong to a specific page
function
page_sections
(
$page
)
function
page_sections
(
$page
)
{
{
global
$db
;
global
$db
;
...
@@ -86,3 +100,33 @@ function page_sections($page)
...
@@ -86,3 +100,33 @@ function page_sections($page)
return
$sections
;
return
$sections
;
}
}
//function that returns section id
function
return_section_id
(
$section_title
)
{
global
$db
;
$query
=
$db
->
query
(
"SELECT * FROM sections"
);
$i
=
0
;
while
(
$row
=
$query
->
fetchArray
())
{
if
(
$row
[
3
]
==
$section_title
)
{
break
;
}
}
return
$i
;
}
function
return_page_id
(
$page_title
)
{
global
$db
;
$page_id
=
$db
->
querySingle
(
"SELECT id FROM pages WHERE title = '
$page_title
'"
);
return
$page_id
;
}
\ No newline at end of file
\ No newline at end of file
html/index.php
View file @
3afad25
...
@@ -50,6 +50,10 @@ while ($row=$query->fetchArray())
...
@@ -50,6 +50,10 @@ while ($row=$query->fetchArray())
}
}
}
}
$smarty
->
assign
(
"current_page"
,
$current_page
);
$smarty
->
assign
(
"page_id"
,
$page_id
);
$smarty
->
assign
(
"page_id"
,
$page_id
);
$smarty
->
assign
(
"page_title"
,
$page_title
);
$smarty
->
assign
(
"page_title"
,
$page_title
);
$smarty
->
assign
(
"page_text"
,
$page_text
);
$smarty
->
assign
(
"page_text"
,
$page_text
);
...
@@ -58,6 +62,7 @@ $smarty->assign("section_title", $section_title);
...
@@ -58,6 +62,7 @@ $smarty->assign("section_title", $section_title);
$smarty
->
assign
(
"section_text"
,
$section_text
);
$smarty
->
assign
(
"section_text"
,
$section_text
);
$smarty
->
assign
(
"pages"
,
get_pages
());
$smarty
->
assign
(
"pages"
,
get_pages
());
$smarty
->
assign
(
"pages_id"
,
get_pages_id
());
$smarty
->
display
(
"tpl/index.tpl"
);
$smarty
->
display
(
"tpl/index.tpl"
);
...
...
html/tpl/user_sidebar_wrapper.tpl
View file @
3afad25
...
@@ -7,15 +7,30 @@
...
@@ -7,15 +7,30 @@
</a>
</a>
</li>
</li>
{
section
name
=
pages
loop
=
$pages
}
{
section
name
=
pages
loop
=
$pages
}
{
if
$pages_id
[
pages
]
eq
$current_page
}
<li
class=
"has-sub active"
id=
"active"
>
<a
href=
"#"
>
{
else
}
<li
class=
"has-sub"
>
<li
class=
"has-sub"
>
<a
href=
"#"
>
<a
href=
"#"
>
{/
if
}
{
$pages
[
pages
]
}
<i
class=
"fa fa-chevron-right fa pull-right chevron-margin"
id=
"valign-icon"
></i>
{
$pages
[
pages
]
}
<i
class=
"fa fa-chevron-right fa pull-right chevron-margin"
id=
"valign-icon"
></i>
</a>
<ul>
<ul>
<!-- sections here -->
{
assign
var
=
var
value
=
1
}
{
foreach
page_sections
(
$pages
[
pages
])
as
$section_title
}
{
assign
var
=
current_page_id
value
=
return_page_id
(
$pages
[
pages
])
}
{
assign
var
=
link
value
=
"?$current_page_id#$var"
}
<li><a
href=
{
$link
}
class="sub-text-padding"
>
{
$section_title
}
</a></li>
{
assign
var
=
var
value
=
$var
+
1
}
{/
foreach
}
</ul>
</ul>
</a>
</li>
</li>
{/
section
}
{/
section
}
<li
id=
"copyright"
>
© 2013 - 2015 slimspots.com
</li>
</ul>
</ul>
</div>
</div>
<!-- /#sidebar-wrapper -->
<!-- /#sidebar-wrapper -->
\ No newline at end of file
\ No newline at end of file
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment