Using PHP

Current Version: 2.1.0
Released: 2015-10-26
Forum rules
Before creating a new support thread, please take a look at the board3 Portal FAQ and use the search!
Many questions have already been answered.
Locked

Topic author
Lammerts
Active Member
Posts: 6
Joined: 21. May 2020 10:19

Using PHP

Post 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

Topic author
Lammerts
Active Member
Posts: 6
Joined: 21. May 2020 10:19

Re: Using PHP

Post 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?
User avatar

Kirk
Dev
Posts: 1955
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Using PHP

Post by Kirk »

Hi
What have you entered where?
Gruß Udo

Topic author
Lammerts
Active Member
Posts: 6
Joined: 21. May 2020 10:19

Re: Using PHP

Post 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="" />&nbsp;<!-- 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

Code: Select all

Hi
is displayed, so I think the file is in the correct location and the file is called into the block.
User avatar

Kirk
Dev
Posts: 1955
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Using PHP

Post by Kirk »

What do you want to display in this module?
Gruß Udo

Topic author
Lammerts
Active Member
Posts: 6
Joined: 21. May 2020 10:19

Re: Using PHP

Post 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.
User avatar

Kirk
Dev
Posts: 1955
Joined: 27. July 2010 18:02
phpBB.de User: Kirk
Contact:

Re: Using PHP

Post by Kirk »

How to put something like this into a module, I'll have to pass.
Gruß Udo

Topic author
Lammerts
Active Member
Posts: 6
Joined: 21. May 2020 10:19

Re: Using PHP

Post 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?

Topic author
Lammerts
Active Member
Posts: 6
Joined: 21. May 2020 10:19

Re: Using PHP

Post by Lammerts »

Seems no one knows how this module works.
Please close topic

dueller
Active Member
Posts: 2
Joined: 25. June 2020 18:33

Re: Using PHP

Post 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?
Last edited by dueller on 25. June 2020 22:34, edited 1 time in total.

dueller
Active Member
Posts: 2
Joined: 25. June 2020 18:33

Re: Using PHP

Post 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="" />&nbsp;<!-- 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

Code: Select all

Hi
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...
Last edited by dueller on 26. June 2020 00:59, edited 1 time in total.
Locked

Return to “Board3 Portal 2.1.x - English Support”