?
avatar Scrabble96
Scrabble96
1 Jan 2019

Is your feature request related to a problem? Please describe.

I am trying to work out where the stylesheets are - not the css files but the file mentioned below: 'stylesheet' - and how they are called in the J4 index.php file. Then I looked at the error.php and offline.php and discover that they are all completely different.

For example, the top of the error.php is this:
`// Add JavaScript Frameworks
HTMLHelper::_('bootstrap.framework');

// Add template js
HTMLHelper::_('script', 'template.js', ['version' => 'auto', 'relative' => true]);

// Load custom Javascript file
HTMLHelper::_('script', 'user.js', ['version' => 'auto', 'relative' => true]);

// Load template CSS file
HTMLHelper::_('stylesheet', 'template.css', ['version' => 'auto', 'relative' => true]);

// Load custom CSS file
HTMLHelper::_('stylesheet', 'user.css', array('version' => 'auto', 'relative' => true));

// Load specific language related CSS
HTMLHelper::_('stylesheet', 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css', array('version' => 'auto'));`

Whereas the beginning of the offline.php file is like this:

`// Add JavaScript Frameworks
HTMLHelper::_('behavior.core');

// Add Stylesheets
// Load template CSS file
HTMLHelper::('stylesheet', 'template' . ($this->direction === 'rtl' ? '-rtl' : '') . '.css', ['version' => 'auto', 'relative' => true]);
HTMLHelper::
('stylesheet', 'offline.css', ['version' => 'auto', 'relative' => true]);

// Check for a custom CSS file
HTMLHelper::_('stylesheet', 'user.css', ['version' => 'auto', 'relative' => true]);

// Check for a custom js file
HTMLHelper::_('script', 'user.js', ['version' => 'auto', 'relative' => true]);

// Load optional RTL Bootstrap CSS
HTMLHelper::_('bootstrap.loadCss', false, $this->direction);`

Note the different options for the Javascript.Frameworks.
There's no mention of direction in the error.php.

The top of the index.php file bears no resemblance to the other two files at all.

Further testing shows that in fact that changes to template.css and offline.css are completely ignored when the site is taken offline and the offline page displayed. The page continues to display template.min.css but it does display user.css.

I'm not sure how to force the error page to display so haven't been able to test that one.

Describe the solution you'd like

Consistency of coding across the three files.

Also, I need to be able to instruct Joomla! 4 not to use template.min.css but to use template.css instead. I am creating my own template and my resources do not stretch to a min.css generator.

Additional context

avatar Scrabble96 Scrabble96 - open - 1 Jan 2019
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jan 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 Jan 2019
avatar Scrabble96 Scrabble96 - change - 1 Jan 2019
The description was changed
avatar Scrabble96 Scrabble96 - edited - 1 Jan 2019
avatar Scrabble96 Scrabble96 - change - 1 Jan 2019
The description was changed
avatar Scrabble96 Scrabble96 - edited - 1 Jan 2019
avatar ReLater
ReLater - comment - 1 Jan 2019

The page continues to display template.min.css

At the moment it is like this: HTMLHelper::_('script', HTMLHelper::_('stylesheet' are always loading the .min file if present in the same folder.
Only with activated Debug the unminified files wil load.
And there is no switch in HTMLHelper to get rid of this strange behavior that I hate ;-) (Or I'm too blind to see it).

how they are called in the J4 index.php file

If you're talking about Cassiopaia these are the magic lines:

$wa   = $this->getWebAssetManager();
// Enable assets
$wa->enableAsset('template.cassiopeia.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr'));

They load the file joomla.asset.json where the CSS and JS files are defined. Using this file is not a must.

avatar Scrabble96
Scrabble96 - comment - 2 Jan 2019

Thanks, @ReLater

Is HTMLHelper something that can be viewed? Is it a file, or the content of a file? If so, where?

Is the joomla.asset.json a hidden file? I'm using a site on CloudAccess.net and it doesn't show up in the template files in Joomla admin or in the file explorer on the CloudAccess.net control panel. I only know it exists because I saw in when I downloaded the full package and extracted it on my PC.

My other original questions still stand, though, and yes, I am referring to the cassiopeia template:

  1. why are the same css and js files loaded in different ways in error.php and offline.php? For example,
    error.php: // Add JavaScript Frameworks HTMLHelper::_('bootstrap.framework');
    offline.php: / Add JavaScript Frameworks HTMLHelper::_('behavior.core');
    and
    error.php: // Load template CSS file HTMLHelper::_('stylesheet', 'template.css', ['version' => 'auto', 'relative' => true]);
    offline.php: // Load template CSS file HTMLHelper::('stylesheet', 'template' . ($this->direction === 'rtl' ? '-rtl' : '') . '.css', ['version' => 'auto', 'relative' => true]);

The code looking for the user.css and Why the difference?

  1. Adding any css to offline.css has absolutely no effect

  2. There's no mention of direction in the error.php file

  3. There's no reference to language in the offline.php file

  4. error.php and index.php both have the following code in the head:

<head>
	<jdoc:include type="metas" />
	<jdoc:include type="styles" />
	<jdoc:include type="scripts" />
</head>

offline.php has this code for the head:

<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<jdoc:include type="head" />
</head>

Shouldn't there be some consistency in these files?
Thanks.

avatar ReLater
ReLater - comment - 2 Jan 2019

https://github.com/joomla/joomla-cms/blob/4.0.0-alpha6/libraries/src/HTML/HTMLHelper.php#L648

https://github.com/joomla/joomla-cms/blob/4.0.0-alpha6/libraries/src/HTML/HTMLHelper.php#L700

https://github.com/joomla/joomla-cms/blob/4.0.0-alpha6/administrator/templates/atum/joomla.asset.json

https://github.com/joomla/joomla-cms/blob/4.0.0-alpha6/templates/cassiopeia/joomla.asset.json

error.php: // Add JavaScript Frameworks HTMLHelper::_('bootstrap.framework');
offline.php: / Add JavaScript Frameworks HTMLHelper::_('behavior.core');

Because there are different "Frameworks". Core framework, JQuery framework, Bootstrap framework...
First one runs
https://github.com/joomla/joomla-cms/blob/4.0.0-alpha6/libraries/cms/html/bootstrap.php#L151
It's loading core and bootstrap

Second one:
https://github.com/joomla/joomla-cms/blob/4.0.0-alpha6/libraries/cms/html/behavior.php#L62
It loads only core.

If a page doesn't use bootstrap why should the page load it? If it doesn't need this or that framework one should remove/exchange the lines..

Adding any css to offline.css has absolutely no effect

Because offline.min.css is loaded because it exists in the same folder. Rename the min file to load the unminified one. Jomla doesn't minify files on-the-fly. That's your job.

Shouldn't there be some consistency in these files?

If it makes sense or if there are bugs (ltr, rtl, language), yes. I don't know if it makes sense ;-)

You are free to provide Pull Requests! https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests/en

Don't forget to switch the Branch to "4.0-dev" in "Code" tabulator here to find and edit files.

avatar Scrabble96
Scrabble96 - comment - 3 Jan 2019

@ReLater, thank you so much for taking the time to explain all this. I'll get round to absorbing it all in due course.

Regarding the joomla.asset.json - in this case the cassiopeia one - where does it go when the template is installed? In the Joomla! 4 Alpha 6 zip file it's in the same directory as the cassiopeia template index.php, but there's no sign of it in the Joomla! admin panel (System-> Templates-> Site Templates-> Cassiopeia Details and Files) or when viewing the same folder in the server file explorer.

avatar ReLater
ReLater - comment - 3 Jan 2019

but there's no sign of it in the Joomla! admin panel (System-> Templates-> Site Templates-> Cassiopeia Details and Files)

At the moment you have to go to the Template Options view (administrator/index.php?option=com_config&view=component&component=com_templates) and add json to Valid Source Formats. I don't know if this file extension will or should be added as default in the future?

or when viewing the same folder in the server file explorer

I'm only using Nightly Builds for installations "in normal provider accounts". I see the file locally and via FTP. I didn't test it in other environments.

avatar infograf768
infograf768 - comment - 4 Jan 2019

imho, in any case, index.php, offline.php and error.php should load same css depending on language and direction. Patch welcome.

avatar dgrammatiko
dgrammatiko - comment - 6 Jan 2019

FYI none of the default templates should force jQuery and Bootstrap.js for every page. it's already 2019...

avatar ReLater
ReLater - comment - 7 Jan 2019

Concerning "File joomla.asset.json is missing in template editor." See #23470

avatar ReLater
ReLater - comment - 7 Jan 2019

FYI none of the default templates should force jQuery and Bootstrap.js for every page.

And an error.php should never ever load more things than necessary for clearing an error. It's already completely overloaded with modules and things in Cassiopaia.

avatar mbabker
mbabker - comment - 7 Jan 2019

Just an extra point here to note the ErrorDocument is refactored in 4.0 to
extend the HtmlDocument (and inherently can properly render modules and
other jdoc slots) since quite commonly error pages include modules (many
sites just change what is the component area to the error page’s content
and still render the usual header/footer). Cassiopeia can be opinionated
on how many positions it supports but it shouldn’t flat out not support
module positions.

(Also of note configuring error page specific modules in the UI could
possibly use some thinking)

On Sun, Jan 6, 2019 at 7:27 PM ReLater notifications@github.com wrote:

FYI none of the default templates should force jQuery and Bootstrap.js for
every page.

And an error.php should never ever load more things than necessary for
clearing an error. It's already completely overloaded with modules and
things in Cassiopaia.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#23422 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAWfoa1pKthfqIorPRWmrEHytn-QETc1ks5vAqKJgaJpZM4Zl9tL
.

--

  • Michael Please pardon any errors, this message was sent from my iPhone.
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Mar 2019

@Scrabble96 is this Issue solved?

avatar joomla-cms-bot joomla-cms-bot - edited - 28 Mar 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Title
J4 PHP section of error.php, offline.php and index.php files all different; code ignored
[4.0] PHP section of error.php, offline.php and index.php files all different; code ignored
Status Discussion Information Required
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Category Code style
avatar Scrabble96
Scrabble96 - comment - 30 Mar 2019

@Scrabble96 is this Issue solved?

Well, I wouldn't say solved, exactly, as the topic went off in several directions and other topics, links to help files, given and differing opinions from other commenters, etc., so probably best just to close it for now. It's probably all covered elsewhere.

avatar Scrabble96 Scrabble96 - change - 30 Mar 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-03-30 11:38:30
Closed_By Scrabble96
avatar Scrabble96 Scrabble96 - close - 30 Mar 2019

Add a Comment

Login with GitHub to post a comment