Page 1 of 1
					
				Using PHP
				Posted: 21. May 2020 10:22
				by Lammerts
				Hello,
I am creating my own module
Therefor I followed the instructions from the knowledge base (
https://github.com/board3/Board3-Portal ... rtal-2.1.x)
All is setup and working 
 
But it seems I can't use php coding in the module.
Am I doing something wrong?
How can I use php when creating my own module?
Thank you
 
			
					
				Re: Using PHP
				Posted: 26. May 2020 19:52
				by Lammerts
				Oh, almost 1k views but no one who can give me a little help?
I know I should use  ***_side.php extension, but even that doesn't help me.
Maybe some have other ideas?
			 
			
					
				Re: Using PHP
				Posted: 27. May 2020 09:02
				by Kirk
				Hi
What have you entered where?
			 
			
					
				Re: Using PHP
				Posted: 27. May 2020 18:06
				by Lammerts
				Thank you for the reply
In my main file I have the line 
Code: Select all
return '@lammert_daservermonitor/lammert_da_servermonitor_side.php';
I have the file called "lammert_da_servermonitor_side.php" in the folder .\phpBB3\ext\lammert\daservermonitor\styles\Hexagon\template.
The code in the file:
Code: Select all
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
<div style="text-align: center;">
<?php echo "Hello"; ?>
Hi
</div>
<br />
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
In the block on the frontpage 
 is displayed, so I think the file is in the correct location and the file is called into the block.
 
			
					
				Re: Using PHP
				Posted: 30. May 2020 09:26
				by Kirk
				What do you want to display in this module?
			 
			
					
				Re: Using PHP
				Posted: 30. May 2020 10:06
				by Lammerts
				I try to create some custom modules for our Wolfenstein:ET community.
Some info about the server, the map plying and players on server.
The code is ready and the info is in a file I made: 
Here
The info is from een opensource (
ET Splatterladder
This needs to be in a module on our community site: 
Here
When this is done, I want to create a module with names of the admins, which needs to be editable by admins.
But have not worked on that one yet.
 
			
					
				Re: Using PHP
				Posted: 30. May 2020 17:30
				by Kirk
				How to put something like this into a module, I'll have to pass.
			 
			
					
				Re: Using PHP
				Posted: 30. May 2020 20:39
				by Lammerts
				Thank you for your time and effort 
 
To me it looks like the module can handle HTML, but not PHP.
Maybe someone can answer this?
If it is possible to use PHP in a module, then I wonder how it can be done.
Maybe someone knows this?
To me it feels like a rather simple question, but somehow it is not.
Maybe anyone knows why?
 
			
					
				Re: Using PHP
				Posted: 14. June 2020 17:24
				by Lammerts
				Seems no one knows how this module works.
Please close topic
			 
			
					
				Re: Using PHP
				Posted: 25. June 2020 22:32
				by dueller
				I also tried to use php and it gets commented out.
In the above example the line <?php echo "Hello"; ?> it gets commented and so it doesn't produce the "Hello" message, but only "Hi" that is printed with html code. 
Did I miss something?
			 
			
					
				Re: Using PHP
				Posted: 26. June 2020 00:41
				by dueller
				Lammerts wrote: 27. May 2020 18:06
Thank you for the reply
In my main file I have the line 
Code: Select all
return '@lammert_daservermonitor/lammert_da_servermonitor_side.php';
I have the file called "lammert_da_servermonitor_side.php" in the folder .\phpBB3\ext\lammert\daservermonitor\styles\Hexagon\template.
The code in the file:
Code: Select all
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
<div style="text-align: center;">
<?php echo "Hello"; ?>
Hi
</div>
<br />
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
In the block on the frontpage 
 is displayed, so I think the file is in the correct location and the file is called into the block.
 
At last I figured it out.
In the above example you have to give your file the html extension, lammert_da_servermonitor_side.html (php extension does nothing more).
Then you can't use php in it BUT INSTEAD OF IT YOU MUST USE twig template engine.
So instead of <?php echo "Hello"; ?> (that gets commented out) you MUST USE the equivalent {{ "Hello" }}
Such a basic thing that no one ever mentioned, I found it by searching in the code of other modules...