Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

New answers tagged

0

You can do that from the template side. Add this code below in the top of the file ../templates/your_default_template_name/offline.php, after the defined('_JEXEC') or die; part $currentTime = new JDate(); $siteLive = new JDate('2019-11-21 11:21:36'); // Change to your site live if($currentTime >= $siteLive ) { $str = file_get_contents('configuration....


1

You could create a cron job that runs daily and executes a PHP file. You should be able to set this up in your hosting control panel. Command: php /home/xxx/public_html/cli/sitelive.php Then go to: https://www.unixtimestamp.com/index.php, add the date you wish to go live and convert it to a UNIX timestamp. sitelive.php: const _JEXEC = 1; error_reporting(...


0

I am assuming you are referring to the $offline field in configuration.php is set to something other than 0 to make your website offline. If your are disabling at a server or .htaccess level then this answer won't be much help. A fairly simple plugin that stores the date/time you want the site to go online. The plugin will check each time someone visits the ...


0

I managed to get this working by editing the (already existing Helix / Joomshaper) override. After spending a (very!) long time trying to figure out where the /items url parameter was coming from, I gave up and modified the override. I know this isn't a solution but it solves my problem, and possibly someone else that uses the Helix framework or a ...


1

Sometimes you can't see the forest for the trees. My JS now looks like this function addDate(target_field) { document.getElementById(target_field).value = currentDate(); document.getElementById(target_field).focus(); document.getElementById(target_field).blur(); } and it works !!!


3

I would have preferred to just suggest some touch ups to your snippet, but there is too much for me to address in your answer as a comment and I'd rather explain fully. Instead, I'll post this new answer which will review and clean up your assumed-working coding attempt for the benefit of you and future researchers. You are declaring $images = json_decode($...


1

The solution to my question. I think is valid: <?php $images = json_decode($item->images); ?> <span itemprop="image" itemscope itemtype="https://schema.org/ImageObject"> <link itemprop="url" href="<?php // Create new DOMDocument object. $dom = new DOMDOcument; // Load article text into DOMDocument. $dom->loadHTML($item->...


0

Hard to give a precise answer without more detail, so this will be oversimplified, perhaps too much so, but I'll try. Joomla URLs natively look like someone dumped part of a can of alphabet soup on the screen. Joomla uses those numbers to find the content being requested, but why should a site visitor have to put up with such a jumble? And what is a search ...


0

From Joomla 3.8 and higher you can use Namespacing use Joomla\CMS\MVC\Model\BaseDatabaseModel; BaseDatabaseModel::addIncludePath(JPATH_SITE . '/components/com_content/models'); $articleModel = BaseDatabaseModel::getInstance('Article', 'ContentModel'); $article = $articleModel->getItem($articleId); $access = $article->access;


1

Try this workaround below, by calling jquery.framework from the article. It should override jquery.framework call that comes from your template so then jquery will be called before your script. {source} <?php JHtml::_('jquery.framework'); $doc = JFactory::getDocument(); $doc->addStyleSheet('mycode/css/article_1.css'); $doc->...


1

It’s a jQuery conflict (more like noConflict issue). You should start and wrap your script for example like: jQuery.noConflict(); (function( $ ) { // if you want to use $ $(function() { // More code using $ as alias to jQuery }); })(jQuery); Or redefine jQuery like: var $j = jQuery.noConflict(); // $j is now an alias to the jQuery function; ...


1

*** Update - This solution works provided the date input field is not have a type="calendar" in the Joomla forms .xml. I will raise a separate question to try and work out why and report back here. My solution to change the date field on a change in the current stock when entered via the form involved learning enough JS to become dangerous. :) My ...


1

Helix3 is based on Bootstrap 4, But all col classes for megamenu have prefix col-sm Think the easiest method is to add custom class name .col5 to your megamenu and split row into 6 columns. Then you can add this CSS: .sp-has-child.col5 .col-sm-2 { -ms-flex-preferred-size: 0; flex-basis: 0; -webkit-box-flex: 1; -ms-flex-positive: 1; flex-grow: 1;...


0

After trying every possible way I could imagine I finally found the solution and I've been pretty close with the version I mentioned in this post. class BookstoreRouter extends JComponentRouterView { public function __construct($app = null, $menu = null) { $books = new JComponentRouterViewconfiguration('books'); $this->...


0

OK, I've found the solution. I simply changed the last line of custom.css to this: #toolbar .float-left .module:last-of-type { float: none !important; width: 100% !important; position: static; /* add to override its previous "module" ruling */


0

You can use the inspector in Chrome or Firefox to inspect the HTML + CSS. The issue with the non-clickable logo seems to be caused by the float: left; in your CSS. If you remove it, the logo is clickable again. However, the top bar won't look good; You have to solve that in another way. #toolbar .float-left .module, #toolbar .float-left>time { margin:...


1

I won't pretend to believe that this answer will completely resolve your problem, but I do see a couple things to be fixed up. if (!strpos($id, ':')) is not advisable practice even if it does what you intend to do. To check if a substring exists within a string you should be performing a strict boolean check on false (either !== or ===) if (strpos($id, ':'...


0

Continuing from Dom's answer, if you are rendering a calendar using xml JForm and JFormField, you can write something like this, even though I couldn't find it in Joomla docs: <field name="date" type="calendar" default="NOW" label="COM_EXAMPLE_FORM_LBL_DATE" description="COM_EXAMPLE_FORM_DESC_DATE" hint="COM_EXAMPLE_FORM_LBL_DATE" format="%Y-%m-%...


1

There seem to be a couple of Joomla modules which allow you to search for text within the same page using JavaScript. Not sure if this is what you are looking for https://jdev.l-it.co.za/products/in-page-search-term-highlighter This module basically lets you search for content within the same page you are on, similar to the CTRL+F browser search feature.


0

I would suggest you look at creating a plugin to send the email that responds to a onContentChangeState event trigger. The plugin would check that it is an item of your component being changed($context in the params) and then it will provide the ID and the value(Published/Unplublished) that you can use in your email subject or body. This should be a ...


1

The code required to extract the first name of the currently logged in user is fairly simple. Here's an example: <?php $user = JFactory::getUser(); if (!$user->guest) { echo strtok($user->name, ' '); } ?> Using the free or paid version of Sourcerer you could insert the code directly into an article as follows: {source}<?php $user =...


1

When you create your custom field. On the right side you can choose which category /categories this particular field will show in. In your case, from what I understand, you chose the 1st level category so if the 3rd level category is a child of the 1st level one it will show on the 3rd category as well. If you want to show on the 3rd level category only but ...


1

parsererror : SyntaxError: Expected identifier was actually causing issues with the JS code on IE. I had to do a line by line debug and finally found 2 instances in the code that was causing this- I was using this to loop through an object- for(const [serial, dates] of Object.entries(data)) {. Had to replace this with a simpler for...in loop like- for (var ...


0

For security reasons, Joomla! uses a CSRF Token to secure any sensitive information in order to attempt to prevent any malicious form manipulation. The short answer you need the token to attempt to do this via url but it might not work. Your best bet would be to use your favorite web browser autofill capabilities. Take care.


1

I'd suggest running an Audit using Chrome Dev Tools. This will gauge your site performance and give you more details about what you can do to improve it. Alernatively, you can use https://web.dev which also uses Lighthouse behind the scenes. Seeing as you have a lot of assets, you'd ideally want to start lazy loading images. Chrome has a built-in attribute ...


Top 50 recent answers are included