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

How to display both main category and sub-category of question in view question page?

+3 votes
4,877 views
asked May 3, 2014 in Q2A Core by rgd
If we ask question under main category "Agriculture" and sub category "Plantation" , in the question view page the question displays only category "Plantation".

I want to display both main category and sub-category of question in view question page.
Q2A version: 1.6.3

1 Answer

+1 vote
answered May 4, 2014 by jatin.soni
edited May 7, 2014 by jatin.soni

I haven't tested or even tried practically but you can try by overriding the function and add backpath last (base) item.


Edit:

The backpath column contains the parent categories path. So if it has two parents than cat1/cat2 and if it has only one parent than cat1 etc..

So you can either explode by / and get last item by using end($array) which will gives you last item of the exploded array. If you want to display every item of the backpath than just run the foreach loop to list every item of the exploded array.

I just landed back to the country so not able to add any example at the moment but will add in future if get time.

Hope this will helps you guyz

commented May 7, 2014 by rgd
Thank you very much again. I will try this and tell you.
commented Nov 21, 2014 by joel
i am unable to do it, i really that know where to look for the code to edit, if you can directly me. that will be great. thanks
...