Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How to export data about page - URL and Title

+4 votes
110 views
asked Feb 7 in Q2A Core by Dmytro Pastovenskyi
Is it possible to export URL of pages from my forum based on Q2A?

I have access to my database and can run queries, however I did not find URL column so far. How would I do that?

My current query to database (however I do not know how to get URL)

SELECT title, created FROM `qa_posts` WHERE tags LIKE '%news%'
Q2A version: 1.7.1

2 Answers

+3 votes
answered Feb 7 by pupi1985
selected Feb 13 by Dmytro Pastovenskyi
 
Best answer

As ProThoughts mentioned, the appropriate way to get the URL should be using the Q2A functions themselves. E.G.: calling the qa_q_request() or qa_q_path() functions for each question. However, if this is not possible you can still get around this.

The URL for your questions is basically the protocol/schema, the domain under Q2A is being stored, followed by the root to Q2A and then the question ID. The title is not really necessary (it is just there for SEO). Considering you want to access the URL from outside the framework, you will need absolute URLs rather than relative. That actually simplifies things as you just need to go to admin/general and get the value from "Preferred site URL" to get everything but the question ID (e.g.: http://www.question2answer.org/qa/). Then, it is just a matter of appending the question ids.

So the full query that returns question URLs and titles should look like this:

SELECT 
    CONCAT(
        (
            SELECT content
            FROM qa_options
            WHERE title = 'site_url'
        ),
        postid
    ) url,
    title
FROM qa_posts
WHERE `type` = 'Q'

+2 votes
answered Feb 7 by ProThoughts
You may need to write some script to do that, btw which forum software you are using, vbulletin, phpbb, smf ??

You can also do one more things, get questions and answers from database in xls format then use below plugin to upload on Q2A. it is paid plugin, I tried and it works very well.

http://question2answer.org/qa/54488/new-premium-plugin-bcg-bulk-content-generator
...