Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
046d33db
Commit
046d33db
authored
Mar 07, 2014
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move ask page similar questions into theme
Plus new function q_title_list for generic list of question titles.
parent
d89d75ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
17 deletions
+44
-17
qa-ajax-asktitle.php
qa-include/qa-ajax-asktitle.php
+11
-17
qa-theme-base.php
qa-include/qa-theme-base.php
+33
-0
No files found.
qa-include/qa-ajax-asktitle.php
View file @
046d33db
...
...
@@ -26,6 +26,8 @@
require_once
QA_INCLUDE_DIR
.
'qa-db-selects.php'
;
require_once
QA_INCLUDE_DIR
.
'qa-util-string.php'
;
require_once
QA_INCLUDE_DIR
.
'qa-app-users.php'
;
require_once
QA_INCLUDE_DIR
.
'qa-app-format.php'
;
// Collect the information we need from the database
...
...
@@ -46,8 +48,6 @@
// Collect example tags if appropriate
if
(
$doexampletags
)
{
require_once
QA_INCLUDE_DIR
.
'qa-app-format.php'
;
$tagweight
=
array
();
foreach
(
$relatedquestions
as
$question
)
{
$tags
=
qa_tagstring_to_tags
(
$question
[
'tags'
]);
...
...
@@ -85,27 +85,21 @@
// Collect and output the list of related questions
if
(
$doaskcheck
)
{
require_once
QA_INCLUDE_DIR
.
'qa-app-format.php'
;
$minscore
=
qa_match_to_min_score
(
qa_opt
(
'match_ask_check_qs'
));
$maxcount
=
qa_opt
(
'page_size_ask_check_qs'
);
$count
=
0
;
$minscore
=
qa_match_to_min_score
(
qa_opt
(
'match_ask_check_qs'
));
$maxcount
=
qa_opt
(
'page_size_ask_check_qs'
);
$relatedquestions
=
array_slice
(
$relatedquestions
,
0
,
$maxcount
);
$limitedquestions
=
array
();
foreach
(
$relatedquestions
as
$question
)
{
if
(
$question
[
'score'
]
<
$minscore
)
if
(
$question
[
'score'
]
<
$minscore
)
break
;
if
(
!
$count
)
echo
qa_lang_html
(
'question/ask_same_q'
)
.
'<br/>'
;
echo
strtr
(
'<a href="'
.
qa_q_path_html
(
$question
[
'postid'
],
$question
[
'title'
])
.
'" target="_blank">'
.
qa_html
(
$question
[
'title'
])
.
'</a><br/>'
,
"
\r\n
"
,
' '
)
.
"
\n
"
;
if
((
++
$count
)
>=
$maxcount
)
break
;
$limitedquestions
[]
=
$question
;
}
$themeclass
=
qa_load_theme_class
(
qa_get_site_theme
(),
'ajax-asktitle'
,
null
,
null
);
$themeclass
->
q_ask_similar
(
$limitedquestions
,
qa_lang_html
(
'question/ask_same_q'
));
}
...
...
qa-include/qa-theme-base.php
View file @
046d33db
...
...
@@ -2209,6 +2209,39 @@
);
}
function
q_title_list
(
$q_list
,
$attrs
=
null
)
/*
Generic function to output a basic list of question links.
*/
{
$this
->
output
(
'<ul class="qa-q-title-list">'
);
foreach
(
$q_list
as
$q
)
{
$this
->
output
(
'<li class="qa-q-title-item">'
,
'<a href="'
.
qa_q_path_html
(
$q
[
'postid'
],
$q
[
'title'
])
.
'" '
.
$attrs
.
'>'
.
qa_html
(
$q
[
'title'
])
.
'</a>'
,
'</li>'
);
}
$this
->
output
(
'</ul>'
);
}
function
q_ask_similar
(
$q_list
,
$pretext
=
''
)
/*
Output block of similar questions when asking.
*/
{
if
(
!
count
(
$q_list
))
return
;
$this
->
output
(
'<div class="qa-ask-similar">'
);
if
(
strlen
(
$pretext
)
>
0
)
$this
->
output
(
'<p>'
.
$pretext
.
'</p>'
);
$this
->
q_title_list
(
$q_list
,
'target="_blank"'
);
$this
->
output
(
'</div>'
);
}
}
...
...
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