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

<script>...</script> not working in PB modules was created by trogladyte

Posted 2 years 10 months ago #60849
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.

Replied by ced1870 on topic <script>...</script> not working in PB modules

Posted 2 years 10 months ago #60855
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

by ced1870

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

Replied by trogladyte on topic <script>...</script> not working in PB modules

Posted 2 years 10 months ago #60935
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.631 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 845 guests and one member online