Welcome to the Question2Answer Q&A. There's also a
demo
if you just want to try it out.
Login
Login
Register
All Activity
Questions
Hot!
Unanswered
Tags
Users
Ask a Question
About
Wiki
Welcome to the Q&A for
Question2Answer
.
If you have questions about the platform,
click here to ask
and please use English.
If you just want to try Q2A, please use the
demo
, which also grants admin access.
Jan 18:
1.5 release
Related questions
How can I get rid of what appears to be question number in the URL?
How to retrieve a single question from the database.
How to load a single question overview
How to larger "My Question is Different" with CSS? its too tiny!
College Q&A Website, I want to be able to have a Ask Question Box On the main page.
Theming question: How to refer to the single question site only ?
How to tell (from theme) that we're editing the question?
number comment in question...
In similar question when asking, is it possible to give more weight to a word when the question title is shorter
Can the "Ask a question" box be extracted to be place in other part of the site?
All categories
Q2A Core
(2,732)
Plugins
(173)
Want to build a todays question feature, how to access a single question by its number in advanced theme ?
+4
votes
Hello,
I want to build this feature and have added in a special div each day another question of my choice.
The questions are allready in the system, now how do I access lets say question number 470 ?
How would I have to change this code, to load only question 470 ?
'<A HREF="'.$question['url'].'">'.$question['title'].'</A>'
Or is it much more complicated ?
Thanks so far
Monk333
question
today
asked
Aug 21, 2010
in
Q2A Core
by
monk333
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1 Answer
0
votes
Try this:
$rawquestion=qa_db_single_select($qa_db,
qa_db_full_post_selectspec(
qa_get_logged_in_userid($qa_db),
470
)
);
You can then access the fields you want from $rawquestion, which will be raw information from the database, not already formatted for HTML. Use print_r() to get an idea of all the fields it contains.
You can get the title to display from qa_html($rawquestion['title']) and the URL from qa_path_html(qa_q_request($rawquestion['postid'], $rawquestion['title'])) - look in function qa_post_html_fields(...) in qa-app-format.php for other ways to convert raw Q info into HTML.
answered
Aug 23, 2010
by
gidgreen
Show 2 previous comments
I found something regarding the database:
qa_pregpages--> VALUES (4, 'daily', '_', 1, 0, 'daily', '', '470');
There the number of the daily page (470 here) is stored.
I as well found the function to get the content of the pages:
qa_db_page_full_selectspec($slugorpageid, $ispageid)
But I cant write the function to get the questionnumber into a variable.
Shouldnt be so complicated, but i am still a beginner. Someone ? Thank You so much.
Your best option is to store the question number in the qa_options table.
First choose a name for the option like 'daily_question_id'.
Then add this to the $showoptions array in one of the 'case's near the top qa-page-admin.php, depending on which page you want it to show on.
You can then get the value of this option from within the theme code using qa_get_option($qa_db, 'daily_question_id') - pass that instead of 470.
Please
log in
or
register
to add a comment.