Hi there,
I would like to create a simple one-page website with a glossary of words in two languages and a search tab. The search tab should find the single words both in English and German and I was wondering how can I do it.
I made a search template that works only if I open the page on that template but I try to copy the code in a snippet so search.php as snippet it says error.
I would like to integrate the search tab on my home page where I would like to have also all my glossary.
As a second question, can I list all my glossary words by alphabetic order?
Do you have any suggestions? or is there any Glossary plugin?
Could you post all relevant code, please? I don’t really understand what you are trying to do… if you define variables in your controller or template, you have to pass them to your snippets if you use them there.
Yes,
so for the first problem I added all the code to the snippet but my search tab does not appear in the home page. I placed the search code in a snippet and added to the home.
The problem is that you have put controller code return function()... into a snippet, that is not possible.
If you need the snippet in more than one place, the logic can be in the snippet, that is ok. Your action URL, however, should point to the current page in this case, not to a search page if you want to output the results directly in the current page.
As a new question, is it possible to make a search tab which searches from one language to another? Like for example this website: https://context.reverso.net/translation/
I am asking not for a commercial project but as a school glossary so If I would be able to develop my search bar would be also more interesting rather than buying a plugin.
Thanks for the answers!
Yes, anything is possible, but you have to code this. Depending on search direction, you would either search in language A and display the results in language B or vice versa.