Question - Creating Links in Cats/Forums

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
User avatar
AWFordJr
Registered User
Posts: 7
Joined: Sun Nov 26, 2023 12:44 am
Location: USA, Tennessee
Name: Anthony (Tony) Ford

Question - Creating Links in Cats/Forums

Post by AWFordJr »

Question_TargetBlank1.png
Is there a way I can by default change the links created here to open as they would if I used target="_blank"? This is the only are I am interested in as I have made my own BBCode for other links I create in the forums themselves which does what I need it to. I prefer not to have to use an extension or other mods but instead change code in the php if possible which I am sure is needed.

I just do not want my traffic to leave my site when links created here are clicked. Also might you guys consider adding a drop down option to chose wither or not you want to make it self, new, etc?

Thanks!
You do not have the required permissions to view the files attached to this post.
Last edited by Mick on Fri Dec 01, 2023 9:49 am, edited 1 time in total.
Reason: Solved.
User avatar
Sniper_E
Registered User
Posts: 1166
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

Re: Question - Creating Links in Cats/Forums

Post by Sniper_E »

Open your style's template/forumlist_body.html and around line 49

Find

Code: Select all

<a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a>
Replace with

Code: Select all

<a href="{forumrow.U_VIEWFORUM}" class="forumtitle"<!-- IF forumrow.CLICKS --> target="_blank"<!-- ENDIF -->>{forumrow.FORUM_NAME}</a>
Then any Linked forum you create or have created will have target="_blank" in it's link by default.
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
ssl
Registered User
Posts: 1815
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: Question - Creating Links in Cats/Forums

Post by ssl »

AWFordJr wrote: Mon Nov 27, 2023 2:57 am I prefer not to have to use an extension or other mods but instead change code in the php
Just to complicate life for future updates
Sorry for my English ... I do my best!

phpBB: 3.3.12 | PHP: 8.3.7
[Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
User avatar
Sniper_E
Registered User
Posts: 1166
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

Re: Question - Creating Links in Cats/Forums

Post by Sniper_E »

There is nothing complicated about adding an if statement to a style after updating it.
If that is what the OP wants then there is nothing wrong with that. Your opinion doesn't matter his does.

Not that it matters either but that is my opinion. My goodness, show some Support instead of your Rude comments.
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26681
Joined: Fri Aug 29, 2008 9:49 am

Re: Question - Creating Links in Cats/Forums

Post by Mick »

AWFordJr wrote: Mon Nov 27, 2023 2:57 amAlso might you guys consider adding a drop down option to chose wither or not you want to make it self, new, etc?
If you have an idea you think should be added to the phpBB core you can post in the Ideas forum.

This question has been brought up many times in the past, there are as many pros as cons.

On the subject of the drop down my opinion is it’s unnecessary as there’s always right click and I’m under the impression this can also be achieved within browsers themselves these days.
AWFordJr wrote: Mon Nov 27, 2023 2:57 amI prefer not to have to use an extension or other mods but instead change code
Be aware phpBB no longer recommends or supports code modification since around 2010 when the extension system was born. Extensions are easy to use and, with the ability to turn them off with one click, don’t affect future updates and upgrades. If you do decide to go down the editing path make notes of everything you do for future reference.
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel©
🇬🇧
User avatar
ssl
Registered User
Posts: 1815
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: Question - Creating Links in Cats/Forums

Post by ssl »

Sniper_E wrote: Mon Nov 27, 2023 8:37 am Not that it matters either but that is my opinion. My goodness, show some Support instead of your Rude comments.
You need to calm down a little, it's not a rude character, far from it, just a remark as Mick says regarding future updates.
Sorry for my English ... I do my best!

phpBB: 3.3.12 | PHP: 8.3.7
[Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
User avatar
Sniper_E
Registered User
Posts: 1166
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

Re: Question - Creating Links in Cats/Forums

Post by Sniper_E »

Mick wrote:If you have an idea you think should be added to the phpBB core you can post in the Ideas forum
If you setup a poll there I think having a "Open linked forum in a new window: Yes / No" under the "Forum link" line would work.
And in the template a (% if forumrow.CLICKS && forumrow.EXTERNAL_LINK %} statement to set it off.
Mick wrote:If you do decide to go down the editing path make notes of everything you do for future reference.
I agree. And that was very nice of you to support the OP by giving him that suggestion. Do you give lessons on nice? :lol:

I went ahead and posted in the Ideas forum for this. Open forum links in new widow if you would like to give your yes vote. No Nos allowed :D
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
ssl
Registered User
Posts: 1815
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: Question - Creating Links in Cats/Forums

Post by ssl »

Not

Code: Select all

<!-- IF forumrow.CLICKS --> target="_blank"<!-- ENDIF -->>
but

Code: Select all

<!-- IF forumrow.CLICKS --> target="_blank"<!-- ENDIF -->
Sorry for my English ... I do my best!

phpBB: 3.3.12 | PHP: 8.3.7
[Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53469
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Question - Creating Links in Cats/Forums

Post by Brf »

ssl wrote: Mon Nov 27, 2023 12:47 pm Not
No. The original code is correct. You need the second > to close the HTML <a tag.
User avatar
warmweer
Jr. Extension Validator
Posts: 11411
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Question - Creating Links in Cats/Forums

Post by warmweer »

Sniper_E wrote: Mon Nov 27, 2023 8:37 am There is nothing complicated about adding an if statement to a style after updating it.
Agreed: in fact the Group Template variables extension (which has not been validated for phpBB3.3) only makes it possible to use statements in templates like
<!-- IF S_GROUP_x --> including AND, NOT, OR, perhaps even ELSE and [ELSEIF] (not sure about these last 2)

In other words, it's an extension requiring editing of the template code with each style-update (if that template was changed by the update).
I think it 's one the few extensions (perhaps the only one) actually "promoting" custom edits.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
ssl
Registered User
Posts: 1815
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: Question - Creating Links in Cats/Forums

Post by ssl »

Brf wrote: Mon Nov 27, 2023 1:19 pm
ssl wrote: Mon Nov 27, 2023 12:47 pm Not
No. The original code is correct. You need the second > to close the HTML <a tag.
Yes you're right
Sorry for my English ... I do my best!

phpBB: 3.3.12 | PHP: 8.3.7
[Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
User avatar
Sniper_E
Registered User
Posts: 1166
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

Re: Question - Creating Links in Cats/Forums

Post by Sniper_E »

This topic has been driven off course by someone but while we're here let me say this...

The strict guidelines of not editing the core files since 2010 is a good guideline to follow. I agree 100%.
If you need edits in the core files then it is imperative that you use an extension and not edit the core files.

But the templates and the stylesheets are not considered as core files to me. In my opinion which doesn't make it a fact.
Yet some people want to think that they are core files and I disagree 100%.

The core files include all the files in the root and all of the directories "except" for ext, images, language and styles directories.
Files in these four directories can be changed, added to or replaced without editing the actual core files. Those strict guidelines do not apply here.

By the way where is the OP of this topic? He may have been scared away by all of my rude comments in his post, I apologize OP.
Hey Ford, did you get it sorted out, you good?
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
Talk19Zehn
Registered User
Posts: 876
Joined: Tue Aug 09, 2011 1:10 pm

Re: Question - Creating Links in Cats/Forums

Post by Talk19Zehn »

Hello, perhaps it would be worth a try to test the extension from primehalo:

https://www.phpbb.com/customise/db/exte ... rimelinks/

I'm not sure, as I used it without any errors under phpBB 3.3.5. In the meantime we have arrived at phpBB 3.3.11 and PHP < 7.2 > ....

Best regards
Best regards
phpBB3 Designs - My own works: Stylearea Ongray-Designs, Adventinducement-Calendar for phpBB
User avatar
Sniper_E
Registered User
Posts: 1166
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

Re: Question - Creating Links in Cats/Forums

Post by Sniper_E »

AWFordJr wrote: Mon Nov 27, 2023 2:57 amI prefer not to have to use an extension or other mods but instead change code in the php if possible which I am sure is needed.
Anyways would that ext work on forum links? A forum that links to somewhere else. Read his first post.
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
Talk19Zehn
Registered User
Posts: 876
Joined: Tue Aug 09, 2011 1:10 pm

Re: Question - Creating Links in Cats/Forums

Post by Talk19Zehn »

Hello, yes I have read the first post and the progress. Sorry: And still had the Prime Links EXT in mind even though the OP doesn't want to use an EXT.

Okay, I have also followed and read ideas. According to this, the extension Prime Links by primehalo can be used for such purposes:
viewtopic.php?p=15986221#p15986221

An Example - a question in the EXT support:
https://www.phpbb.com/customise/db/exte ... 91#p809791

AFAIK:
RMcGirr83's External Links Open in New Window extension also fulfils its purpose in a different purposeful conception.

The decision is up to the OP. Examples and arguments have been mentioned ...

Best regards
Best regards
phpBB3 Designs - My own works: Stylearea Ongray-Designs, Adventinducement-Calendar for phpBB

Return to “phpBB Custom Coding”