Advertisement
JCE editor stripping PHP date code Topic is solved
Moderators: pe7er, General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
-
- Joomla! Guru
- Posts: 736
- Joined: Tue Oct 28, 2008 11:06 pm
- Location: NE Florida
- Contact:
JCE editor stripping PHP date code
Trying to place date code in footer for copyright but JCE editor keeps commenting it out. I have profile set to permit php code but it still breaks the code.
<?php
echo date("Y") . "
";
?>
I have tried both with and without the <?php ?> and it comments out or only displays the code, not a date.
<?php
echo date("Y") . "
";
?>
I have tried both with and without the <?php ?> and it comments out or only displays the code, not a date.
Last edited by toivo on Sat Mar 23, 2024 11:58 pm, edited 1 time in total.
Reason: mod note: typo in subject
Reason: mod note: typo in subject
--- http://www.Stuffdone.com ---
Wow. Doing web sites for over 28+ years now. Still learn new tricks...not bad for an old dog
Wow. Doing web sites for over 28+ years now. Still learn new tricks...not bad for an old dog
Advertisement
- toivo
- Joomla! Master
- Posts: 17848
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: JCE editor stripping PHP date code
Where was this PHP code inserted?
If your code was inserted into a newly created Custom module, please note that PHP code is not run unless the website has a plugin that executes PHP code, for example Sourcerer.
If your code was inserted into a newly created Custom module, please note that PHP code is not run unless the website has a plugin that executes PHP code, for example Sourcerer.
Toivo Talikka, Global Moderator
- Webdongle
- Joomla! Master
- Posts: 44681
- Joined: Sat Apr 05, 2008 9:58 pm
Re: JCE editor stripping PHP date code
If 'Prepare Content' (in the Options tab) is set to Yes, will the php code be run then?
Did you allow php in the Profile Editor parameters Advanced?
Did you allow php in the Profile Editor parameters Advanced?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
- toivo
- Joomla! Master
- Posts: 17848
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: JCE editor stripping PHP date code
It will, as long as a plugin like Sourcerer is enabled and executes the code.
Toivo Talikka, Global Moderator
- leolam
- Joomla! Master
- Posts: 20661
- Joined: Mon Aug 29, 2005 10:17 am
- Location: Netherlands/ Germany/ S'pore/Bogor/ North America
- Contact:
Re: JCE editor stripping PHP date code
Yes @Toivo that is correct. You can use PHP-code directly with JCE if the mentioned plugin below is installed or sourcerer or similar plugin
Leo
Alternative to sourcerer https://extensions.joomla.org/extension ... ss-script/Go to the tab Editor Parameters - Advanced. Set the option 'Allow PHP' to Yes, then Save & Close. Once you have installed and enabled the DirectPHP plugin, go to Extensions - Modules, create a new Custom module and you can now enter embed PHP scripts inside the HTML code
Leo
Joomla's #1 Professional Services Provider:
#Joomla Professional Support: https://gws-desk.com -
#Joomla Specialized Hosting Solutions: https://gws-host.com -
#Joomla Professional Support: https://gws-desk.com -
#Joomla Specialized Hosting Solutions: https://gws-host.com -
-
- Joomla! Guru
- Posts: 736
- Joined: Tue Oct 28, 2008 11:06 pm
- Location: NE Florida
- Contact:
Re: JCE editor stripping PHP date code
I did install sourcere but wasn't able to find the other extension suggested.
I ran into issues with that however as Sourcerer added <SPAN> with it's own CSS and each time I try to add to that to reduce the font size and save it, the PHP code is again commented out.
I tried using the CODE section to include the font size but that is stripped by Sorcerer and replaces by it's own css.
After multiple variations I gave up and hard coded 2024 for the copyright/credits and will just change again next hear.
I ran into issues with that however as Sourcerer added <SPAN> with it's own CSS and each time I try to add to that to reduce the font size and save it, the PHP code is again commented out.
I tried using the CODE section to include the font size but that is stripped by Sorcerer and replaces by it's own css.
After multiple variations I gave up and hard coded 2024 for the copyright/credits and will just change again next hear.
--- http://www.Stuffdone.com ---
Wow. Doing web sites for over 28+ years now. Still learn new tricks...not bad for an old dog
Wow. Doing web sites for over 28+ years now. Still learn new tricks...not bad for an old dog
- AMurray
- Joomla! Master
- Posts: 10270
- Joined: Sat Feb 13, 2010 7:35 am
- Location: Australia
Re: JCE editor stripping PHP date code
Sourcer doesn't "add its own CSS" Your site uses whatever CSS you specify (i.e. custom CSS needs to go in the template's user.css file).
Regards - A Murray
General Support Moderator
General Support Moderator
- toivo
- Joomla! Master
- Posts: 17848
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: JCE editor stripping PHP date code
As an afterthought, it is possible to customise the Joomla Footer module that changes the year in the copyright clause automatically. Create a template override of mod_footer and edit the PHP code in the override file. That way future Joomla updates do not overwrite the custom code.
If the site uses Cassiopeia, the override file is templates/cassiopeia/html/mod_footer/default.php. Copy and paste the following code into default.php with your modifications:
If the site uses Cassiopeia, the override file is templates/cassiopeia/html/mod_footer/default.php. Copy and paste the following code into default.php with your modifications:
Code: Select all
<?php
/**
* @package Joomla.Site
* @subpackage mod_footer
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
$lineone = 'Copyright © ' . HTMLHelper::_('date', 'now', 'Y') . ' Example Pty Ltd. All Rights Reserved.'
?>
<div class="mod-footer">
<div class="footer1"><?php echo $lineone; ?></div>
</div>
You do not have the required permissions to view the files attached to this post.
Toivo Talikka, Global Moderator
-
- Joomla! Intern
- Posts: 62
- Joined: Mon Sep 19, 2005 8:33 am
- imanickam
- Joomla! Master
- Posts: 28286
- Joined: Wed Aug 13, 2008 2:57 am
- Location: Chennai, India
Re: JCE editor stripping PHP date code
If there is not much of processing to be done for displaying the footer, the footer module text could be changed using language override as shown below:
Original language sting:
Overridden language sting:
Note:
Original language sting:
Code: Select all
MOD_FOOTER_LINE1="Copyright © %date% %sitename%. All Rights Reserved." ; Note : %date% will be auto replaced by current year! Don't translate
MOD_FOOTER_LINE2="<a href=\"https://www.joomla.org\">Joomla!</a> is Free Software released under the <a href=\"https://www.gnu.org/licenses/gpl-2.0.html\">GNU General Public License.</a>"
Code: Select all
MOD_FOOTER_LINE1="Copyright © %date% Example Pty Ltd. All Rights Reserved. All Rights Reserved." ; Note : %date% will be auto replaced by current year! Don't translate
MOD_FOOTER_LINE2=""
- Probably there could be a css created to hide the class footer2.
- Review of the document https://docs.joomla.org/Help4.x:Languages:_Overrides would be of help in understanding how to create overrides.
Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
Joomla! - Global Moderators Team | Joomla! Core - Tamil (தமிழ்) Translation Team Coordinator
Former Joomla! Translations Coordination Team Lead
Eegan - Support the poor and underprivileged
Joomla! - Global Moderators Team | Joomla! Core - Tamil (தமிழ்) Translation Team Coordinator
Former Joomla! Translations Coordination Team Lead
Eegan - Support the poor and underprivileged
Advertisement