Panneau N0C 04 EN 250 250
Get 15% discount on our partner PlanetHoster with the code PHA-ceikay

<script>...</script> not working in PB modules

More
5 years 5 months ago #60849 by trogladyte
I have been using the following code, in conjunction with the extension DirectPHP to insert the current year in the copyright:
Code:
{?php echo date("Y"); ?}

With Joomla 4, there is no plans to update DirectPHP to be compatible, so, I have started using the following code to accomplish the job.
Code:
<script>document.write( new Date().getFullYear() );</script>

However, if I use it in a PB module, I can enter it, but when I save out of the text block, the year (2021) is shown on a white page. only. If I refresh, I get the admin page back and nothing was saved. If I use a code block it works fine. If it's in a Custom HTML module it's fine. I'd prefer to use a regular text block over a code block. Why will the text block not work?

A good landing is one you can walk away from.
A great landing is one where you can reuse the aircraft!

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #60855 by ced1870
Hi
have you tried the "code" addon ? this is the one that you shall use to put some PHP code for example
CEd

Joomlack Webmaster and Developer

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #60935 by trogladyte
Yes, that's what I've started doing. I just wondered why the text block was stripping the script.

A good landing is one you can walk away from.
A great landing is one where you can reuse the aircraft!

Please Log in or Create an account to join the conversation.

Time to create page: 0.205 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 481 guests and no members online