Change Topic Title Link to redirect to search that title

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
Tarantino
Registered User
Posts: 876
Joined: Sat Feb 18, 2012 1:51 pm

Change Topic Title Link to redirect to search that title

Post by Tarantino »

Hi there,

on phpBB3 by default on viewtopic the Topic Title Link redirects to the topic itself, and for me it doesn't makes sense and its useless. So what I wanted to acheive is to change that link, to another.
I want to redirect not for itself but for a search, where it will search his own title.

Example: http://i.imgur.com/4uzMslL.png
If I clicked on that URL, it would search by "Preventing Spam in phpBB3", like this:

Code: Select all

https://www.phpbb.com/community/search.php?keywords=Preventing+Spam+in+phpBB3&terms=all&author=&sc=1&sf=titleonly&sr=topics&sk=t&sd=d&st=0&ch=300&t=0&submit=Search 
How can I do that?

Best Regards
Last edited by Oyabun1 on Wed May 27, 2015 9:06 pm, edited 1 time in total.
Reason: Moved from 3.0.x Support forum
User avatar
AmigoJack
Registered User
Posts: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Change Topic Title Link to redirect to search that title

Post by AmigoJack »

Tarantino wrote:its useless
No. Topics are displayed by either requesting a post (viewtopic.php?p=14090301) or by requesting a topic (viewtopic.php?f=72&t=2318381). In the first case I still don't know the topic ID. And both things are entities: posts can be moved (hence reside in another topic), whereas topics are literally just that.
Tarantino wrote:

Code: Select all

keywords=Preventing+Spam+in+phpBB3
Are you aware that you are just searching for keywords and not for the entire topic title as phrase? Based on the used search engine titles like "hey" will most likely result in no search results at all, since too common words are excluded.

Also I don't understand what you wanted to illustrate with your picture.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Tarantino
Registered User
Posts: 876
Joined: Sat Feb 18, 2012 1:51 pm

Re: Change Topic Title Link to redirect to search that title

Post by Tarantino »

I was talking on viewtopic. Not on viewforum. Just to be clear.
And I know that the link to a Topic can be by requesting a post or topic. That is not the question here.

My image above is from a topic of this phpBB forum: viewtopic.php?f=46&t=2122696

Imagine that you click on that page on "Preventing Spam in phpBB3" title (where I've the red dot on the image)
You can see that the link is "viewtopic.php?f=46&t=2122696#p12961708"

But I want that link to be search.php?keywords=Preventing+Spam+in+ ... mit=Search

With that, if I clicked I would be redirect to a search result of that title. (The same as going to search.php and serach by the title: http://i.imgur.com/w791OEJ.png)

I hope to be more clear on what I was asking now.

Best Regards
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: Change Topic Title Link to redirect to search that title

Post by Lumpy Burgertushie »

my question is , what is the point of that? if you do a search for that exact title you would just wind up where you started.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
AmigoJack
Registered User
Posts: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Change Topic Title Link to redirect to search that title

Post by AmigoJack »

Tarantino wrote:Not on viewforum
Did never mention or associate that.
Tarantino wrote:(where I've the red dot on the image)
There are two dots. The upper one is the topic title, which links to the topic in whole, the lower one is the post subject, which links to the post.
Tarantino wrote:the link is "https://www.phpbb.com/community/viewtopic.php?f=46&t=2122696#p12961708"
Neither topic title nor post subject have this URI - you might want to check that yourself in this very topic.
Tarantino wrote:I want that link to be
author=&sc=1 ch=300 submit=Search
Those parameters aren't needed - why do you want them?
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Tarantino
Registered User
Posts: 876
Joined: Sat Feb 18, 2012 1:51 pm

Re: Change Topic Title Link to redirect to search that title

Post by Tarantino »

There are two dots. The upper one is the topic title, which links to the topic in whole, the lower one is the post subject, which links to the post.
I know, you can choose one of them, for me its equal. I would adapt the solution and apply to "Topic Description MOD". Where I've a topic description and it will search by that description. It's the same logic.

I just want to know how to create that URL for the search...
Neither topic title nor post subject have this URI - you might want to check that yourself in this very topic.
I've just copy past... http://i.imgur.com/jCqWjlg.png
Those parameters aren't needed - why do you want them?
I've no idea if it's necessary, I've copy past the URL after the manual search...
User avatar
AmigoJack
Registered User
Posts: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Change Topic Title Link to redirect to search that title

Post by AmigoJack »

Tarantino wrote:for me its equal
As you wish. However, my code will only affect the topic title, not the first displayed post's subject: open /viewtopic.php and find:

Code: Select all

    'U_VIEW_TOPIC'             => $viewtopic_url,
Change to:

Code: Select all

    /*** 2015-06-01 BEGIN AmigoJack
        https://www.phpbb.com/community/viewtopic.php?f=72&t=2318381 ***/
    /*'U_VIEW_TOPIC'             => $viewtopic_url,*/
    'U_VIEW_TOPIC'=> append_sid( "{$phpbb_root_path}search.$phpEx", "terms=all&sr=topics&sf=titleonly&sk=t&sd=d&st=0&keywords=". urlencode( $topic_data['topic_title'] ) ),
    /*** 2015-06-01 END ***/
Tested.
Tarantino wrote:I would adapt the solution and apply to "Topic Description MOD".
Good luck with that one, as the MOD doesn't tweak the board search in the first place.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Tarantino
Registered User
Posts: 876
Joined: Sat Feb 18, 2012 1:51 pm

Re: Change Topic Title Link to redirect to search that title

Post by Tarantino »

Thank you! It solved my problem!

I create a similar one:

Code: Select all

'U_VIEW_TDESC' 			=> append_sid( "{$phpbb_root_path}search.$phpEx", "terms=all&sr=topics&sf=titleonly&sk=t&sd=d&st=0&keywords=". urlencode( $topic_data['topic_desc'] ) ),
and then on html:

Code: Select all

<!-- IF TOPIC_DESC --><p><a href="{U_VIEW_TDESC}">{TOPIC_DESC}</a></p><!-- ENDIF -->
It's working like a charm.

And I've already fixed the search of that MOD :) Some user has solved that for me.

Return to “[3.0.x] MOD Requests”