parameter

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
Post Reply
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

parameter

Post by php_BB_Lover »

Hi,

Dose phpBB have a native method to add parameter to the existing url?

For example i wanna add mypara=a to the existing url.
But when i use ?mypara=a in <a> Tag it will add it to the end of the url with ?. But i wanna check the url first, if its already a parameter in url, add &mypara=a otherwise add ?mypara=a

Thanks
Version: phpBB 3.3.0
Theme: default
Regards
Peter77sx
Registered User
Posts: 3260
Joined: Wed Nov 09, 2005 2:51 pm

Re: parameter

Post by Peter77sx »

Take a look in functions.php and see how parameters are handled for index.php, ucp.php for example.
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: parameter

Post by php_BB_Lover »

Peter77sx wrote:
Wed Jul 15, 2020 2:44 am
Take a look in functions.php and see how parameters are handled for index.php, ucp.php for example.
Question is for existing url (could be any url), not specific url.
Version: phpBB 3.3.0
Theme: default
Regards
User avatar
david63
Registered User
Posts: 19064
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: parameter

Post by david63 »

You could probably use the Twig if function (https://twig.symfony.com/doc/3.x/tags/if.html) in conjunction with the Twig slice function (https://twig.symfony.com/doc/2.x/filters/slice.html)
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: parameter

Post by php_BB_Lover »

david63 wrote:
Wed Jul 15, 2020 7:17 am
You could probably use the Twig if function (https://twig.symfony.com/doc/3.x/tags/if.html) in conjunction with the Twig slice function (https://twig.symfony.com/doc/2.x/filters/slice.html)
But i don't know the url before sending the parameter.
You click on a <a tag to insert a parameter to a url that you are on. But you don't know what url you are on.
I don't know what page it is. Dose it have already parameter in the url or not.
Version: phpBB 3.3.0
Theme: default
Regards
rxu
Extensions Development Team
Posts: 3473
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: parameter

Post by rxu »

Not sure if it is what you're saying about, but there's $user->page array which looks like that:

Code: Select all

  'page_name' => string 'test.php'
  'page_dir' => string ''
  'query_string' => string ''
  'script_path' => string '/phpBB/'
  'root_script_path' => string '/phpBB/'
  'page' => string 'test.php'
  'forum' => int 0
So it's possible to get it on phpBB page and analyze if $user->page['query_string'] contains what you need.
User avatar
david63
Registered User
Posts: 19064
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: parameter

Post by david63 »

rxu wrote:
Wed Jul 15, 2020 9:24 am
So it's possible to get it on phpBB page and analyze if $user->page['query_string'] contains what you need.
But the OP is wanting to do it within the <a> tag which I assume means within the template file, which is why I suggested using Twig functions.
php_BB_Lover wrote:
Wed Jul 15, 2020 9:10 am
But i don't know the url before sending the parameter.
But you know the name of the parameter that you want to add so you just test to see if it is present or not
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: parameter

Post by php_BB_Lover »

rxu wrote:
Wed Jul 15, 2020 9:24 am
Not sure if it is what you're saying about, but there's $user->page array which looks like that:

Code: Select all

  'page_name' => string 'test.php'
  'page_dir' => string ''
  'query_string' => string ''
  'script_path' => string '/phpBB/'
  'root_script_path' => string '/phpBB/'
  'page' => string 'test.php'
  'forum' => int 0
So it's possible to get it on phpBB page and analyze if $user->page['query_string'] contains what you need.
Thank you. Now im on the phone. I will test tomorrow and post the result.
Version: phpBB 3.3.0
Theme: default
Regards
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: parameter

Post by php_BB_Lover »

david63 wrote:
Wed Jul 15, 2020 9:29 am
But the OP is wanting to do it within the <a> tag which I assume means within the template file, which is why I suggested using Twig functions.
Correct. Im doing this in the template file.
But you know the name of the parameter that you want to add so you just test to see if it is present or not
No, i know the parameter that i want to insert. But i don't know the url that im on.
Version: phpBB 3.3.0
Theme: default
Regards
User avatar
david63
Registered User
Posts: 19064
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: parameter

Post by david63 »

php_BB_Lover wrote:
Wed Jul 15, 2020 9:52 am
But i don't know the url that im on.
Then how are you going to do anything if you do not know what you are working with?

If you were to explain fully what it is that you are trying to do, and where you are trying to do it, then it would be a lot easier than trying to pre-guess what you want
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
RMcGirr83
Former Team Member
Posts: 21910
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: parameter

Post by RMcGirr83 »

david63 wrote:
Wed Jul 15, 2020 10:19 am
If you were to explain fully what it is that you are trying to do, and where you are trying to do it, then it would be a lot easier than trying to pre-guess what you want
👍👍👍👍👍👍👍👍
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beerImage
Post Reply

Return to “phpBB Custom Coding”

cron