Page 2 of 3

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 1:29 am
by Toxyy
caiocald wrote:
Thu Dec 20, 2018 1:12 am

Code: Select all

 $topic_id = $this->request->variable('topic_id',0);
Try t instead of topic_id

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 1:58 am
by caiocald
Toxyy wrote:
Thu Dec 20, 2018 1:29 am
caiocald wrote:
Thu Dec 20, 2018 1:12 am

Code: Select all

 $topic_id = $this->request->variable('topic_id',0);
Try t instead of topic_id

Code: Select all

$topic_id = $this->request->variable('t',0);
return 0

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 2:15 am
by Toxyy
caiocald wrote:
Thu Dec 20, 2018 1:58 am
Toxyy wrote:
Thu Dec 20, 2018 1:29 am
caiocald wrote:
Thu Dec 20, 2018 1:12 am

Code: Select all

 $topic_id = $this->request->variable('topic_id',0);
Try t instead of topic_id

Code: Select all

$topic_id = $this->request->variable('t',0);
return 0
When are you calling formulariopontuacao()?

Also try: $this->request->variable('t', '');

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 2:20 am
by caiocald
When are you calling formulariopontuacao()?
When the user clicks the submit form button
Also try: $this->request->variable('t', '');

Code: Select all

$topic_id = $this->request->variable('t', '');
return ''

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 3:11 am
by Toxyy
caiocald wrote:
Thu Dec 20, 2018 2:20 am
When the user clicks the submit form button
Show me this in your github, likely you'll need to add the topic id into the form itself with a hidden input, then you'll be able to pull the data with a request var.

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 3:21 am
by caiocald
Toxyy wrote:
Thu Dec 20, 2018 3:11 am
caiocald wrote:
Thu Dec 20, 2018 2:20 am
When the user clicks the submit form button
Show me this in your github, likely you'll need to add the topic id into the form itself with a hidden input, then you'll be able to pull the data with a request var.
OMG

THATS THE PONIT!

I'll try and tell you

link for my github https://github.com/caiocal/Essay-Extens ... r/main.php

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 3:25 am
by caiocald
how would I specify the value of the imput?

Code: Select all

<input type="hidden" name="topic_id" value="">
thankssssssssssssssssssssssssssssssss

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 3:54 am
by caiocald
i try:

Code: Select all

<input type="hidden" name="topic_id" value="<?= echo"$_GET['t']";?>">
but no... :(

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 5:01 am
by caiocald
definitely does not work.

I enabled the php include in ACP panel security and it still failed.

Code: Select all

<!-- PHP -->echo "$_GET['t']";<!-- ENDPHP -->
It's ... Finishing this extension is going to be a fight ...

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 9:08 am
by mrgoldy
All nice and dandy it is in the current URL, but if it is not in your form action URL you will not be able to request it.
So you either have to append it to your form action's URL or add a hidden input field with the current topic identifier as a value.
Then upon submission you can request it with $topic_id = $this->request->variable('t', 0); (where t is the name attribute of your input field or parameter).

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 9:35 am
by caiocald
mrgoldy wrote:
Thu Dec 20, 2018 9:08 am
All nice and dandy it is in the current URL, but if it is not in your form action URL you will not be able to request it.
So you either have to append it to your form action's URL or add a hidden input field with the current topic identifier as a value.
Then upon submission you can request it with $topic_id = $this->request->variable('t', 0); (where t is the name attribute of your input field or parameter).
Mr. Goldy

I still could not sleep trying to figure it out. I know it seems to be an easy thing. But I can not.
I tried the request. I tried the hidden imput, but it just will not.
you could analyze my code? I only lack this to continue the construction (and maybe finish it) my extension.
Is it not recognizing the url because of lightbox?
Please help me. I'll freak out

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 2:51 pm
by mrgoldy
There is no way to "analyze" your code, as you do not have a link to your GitHub repository.
And please do not see this as an invite to attach a zip here or in a private message.

And well, what can I say, if you can not manage to request an input variable from a form, there is a long road ahead of you.
Anyways, this is the best example I can give you:

Code: Select all

<form action="post" action="{{ U_YOUR_FORM_ACTION }}">
	<!-- YOUR_FORM_ACTION should include &t=5
		or you can use an hidden input like below -->
	<input name="t" type="hidden" value="5">
	
	...
	
	<input class="button1" id="submit" name="submit" type="submit" value="{{ lang('SUBMIT') }}">
</form>

Code: Select all

<?php

namespace vendor\extension\controller;

class main_controller
{
	/** @var \phpbb\request\request */
	protected $request;
	
	public function __construct(\phpbb\request\request $request)
	{
		$this->request = $request;
	}
	
	public function handle()
	{
		// if the form is submitted
		if ($submit = $this->request->is_set_post('submit'))
		{
			// request the form variables
			$topic_id = $this->request->variable('t', 0);
			
			// Do your thing
		}
	}
}

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 6:11 pm
by canonknipser
I would suggest to try the skeleton tool to check out the way extension coding work in their different context (acp, ucp, mcp, standard page ...)

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 7:01 pm
by caiocald
mrgoldy wrote:
Thu Dec 20, 2018 2:51 pm
There is no way to "analyze" your code, as you do not have a link to your GitHub repository.
And please do not see this as an invite to attach a zip here or in a private message.

And well, what can I say, if you can not manage to request an input variable from a form, there is a long road ahead of you.
Anyways, this is the best example I can give you:

Code: Select all

<form action="post" action="{{ U_YOUR_FORM_ACTION }}">
	<!-- YOUR_FORM_ACTION should include &t=5
		or you can use an hidden input like below -->
	<input name="t" type="hidden" value="5">
	
	...
	
	<input class="button1" id="submit" name="submit" type="submit" value="{{ lang('SUBMIT') }}">
</form>

Code: Select all

<?php

namespace vendor\extension\controller;

class main_controller
{
	/** @var \phpbb\request\request */
	protected $request;
	
	public function __construct(\phpbb\request\request $request)
	{
		$this->request = $request;
	}
	
	public function handle()
	{
		// if the form is submitted
		if ($submit = $this->request->is_set_post('submit'))
		{
			// request the form variables
			$topic_id = $this->request->variable('t', 0);
			
			// Do your thing
		}
	}
}
return 0

I can get all the variables I need. The only thing that does not work is topic_id

I posted the link from my repository in the first post of that thread

Re: Help with the adaptation of a tool in php for phpbb extension

Posted: Thu Dec 20, 2018 7:11 pm
by caiocald
canonknipser wrote:
Thu Dec 20, 2018 6:11 pm
I would suggest to try the skeleton tool to check out the way extension coding work in their different context (acp, ucp, mcp, standard page ...)
Hi, Canonknipser

I'm using his model as a reference and it has helped me a lot.
But for this case of the topic, I could not find anything.

Thanks for the tip