Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
1.1k views
in Q2A Core by
1. I want to make breadcrumbs. For example: Home / * title question *. How can I do this?

2. And how can I make writing category, before title to the question? For example: WEB / How do I edit. Css? or Health / How to become a champion?

Sorry for bad English.

Thank you.

1 Answer

+2 votes
by
 
Best answer
1. You'd need an advanced HTML theme which uses PHP to output the appropriate HTML based on the current page. You could use $this->template and/or $this->request in your qa-theme.php to see what kind of page you're viewing.

2. This is easier. Modify qa_post_html_fields(...) in qa-app-format.php as follows:

if (isset($category))
    $fields['where']=qa_lang_html_sub_split('main/in_category_x', qa_category_html($category));

... to ...

if (isset($category)) {
    $fields['where']=qa_lang_html_sub_split('main/in_category_x', qa_category_html($category));
    $fields['title']=qa_html($category['title']).': '.@$fields['title'];
}
by
It helped me. Very thanks! This is a very detailed response. Do it please the default in the next version. I think that many people will be useful.
by
edited by
I am interested in this future(No.1), too. And SiteMap.
I seem not to be able to dismantle a pass well.
Below requestString($this->request) is anxious.

1.1 Question
  Path of question List: questions, activity, unanswered ...
  Path of specific question: 99/q-title
 My perplexity: "99" and "q-title" is not the relations of parent and child.

1.2 User(s)
  Path of user List: users
  Path of specific user(ex:abc): user/abc
  My perplexity: Only "user" is "page not found". "users/abc" ?

1.3 Tag(s)
  Path of tag list: tags
  Path of specific tag(ex:abc): tag/abc
  My perplexity: Only "tag" is "page not found". "tags/abc" ?

1.4 Relation of questions/activity/unanswered/.../Admin ... and each question

【Now(Data structure to think about from pass)】

Root
|
+ users
|
+ user1
+ user2
+ ・・・
+ userN
|
+ questions
|
+ question1
+ question2
+ ・・・
+ questionN
|
+ tags
|
+ tag1
+ tag2
+ ・・・
+ tagN
|
+ activity
+ unanswered
+ search
+ login
+ register
+ account
+ admin
    + option1
    + option2
    + ・・・
    + optionN


【???】

Root
|
+ users
|   + user1
|   + user2
|   + ・・・
|   + userN
|
+ questions
|   + question1
|   + question2
|   + ・・・
|   + questionN
|
+ tags
|   + tag1
|   + tag2
|  + ・・・
|   + tagN
|
+ activity
+ unanswered
+ search
+ login
+ register
+ account
|
+ admin
    + option1
    + option2
    + ・・・
    + optionN
by
I can not to find this code in qa_post_html_fields(...) in qa-app-format.php. It might be different in the current version. If true, do you know how to show breadcrumbs on version 1.5?
by
Yes, this was changed when hierarchical categories were introduced. Look for $fields['where'] to see the expanded version of that code - you can now get the category name from qa_html($post['categoryname']) instead of qa_html($category['title'])
...