?
avatar gostn
gostn
14 Oct 2020

[del]

avatar gostn gostn - open - 14 Oct 2020
avatar joomla-cms-bot joomla-cms-bot - change - 14 Oct 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Oct 2020
avatar ReLater
ReLater - comment - 14 Oct 2020

The main problem is that $this->item->text in this line
https://github.com/joomla/joomla-cms/blob/4.0-dev/components/com_content/tmpl/article/default.php#L100-L102
can contain different content db fields; depending on the settings that a user has made and/or the rights of a visitor. introtext or not. fulltext or not...

I'm using template overrides for each individual site to separate and echo $this->item->introtext and $this->item->fulltext depending on the individual settings. (= annoying work; e.g. if a setting has been changed).

A change in core would be welcome from my point of view but I see no suitable place in core to add CSS classes that a user can override then. Maybe in an overridable JLayout, used by the view? Or an additional backend setting?
https://github.com/joomla/joomla-cms/blob/4.0-dev/components/com_content/src/View/Article/HtmlView.php#L216-L231

avatar Bakual
Bakual - comment - 14 Oct 2020

I wouldn't do that in core as there is to much risk of breaking something.

It's simple enough to do it in an override if needed.
The layout has access to both introtext and fulltext as @ReLater already pointed out. You just need to copy the conditionals from the view (depending on parameter if intro should be shown or not) and wrap it into the tags you want. Eg:

<?php if ($item->params->get('show_intro', '1') == '1') : ?>
	<span class="introtext"><?php echo $item->introtext; ?></span> <?php echo $item->fulltext; ?>
<?php elseif ($item->fulltext) : ?>
	<?php echo $item->fulltext; ?>
<?php else : ?>
	<span class="introtext"><?php echo $item->introtext; ?></span>
<?php endif; ?>

But the joy of $item->text is for example that plugins are triggered on it (they usually don't work with introtext and fulltext).

avatar Bakual
Bakual - comment - 14 Oct 2020

It's actually as complex as pressing a button in the Joomla backend to create the override of the layout.
Editing it is a bit more tricky of course as you need some minimal coding skills - or the ability to copy-paste from a Google result. They also need some skills in CSS and need to know how to add custom CSS rules.

I'd say those users who have such a need, can figure it out.

But then, most of the time it's templates who do that. They already ship with the override and the specific CSS and the user doesn't have to care at all.

avatar jiweigert
jiweigert - comment - 14 Oct 2020

To conclude how easy it is:

  1. Find the right module in the template to create an override
  2. Having the skills to "edit some HTML code" &
  3. understanding Joomlas own functions to do that
  4. Finding the templates CSS-class
  5. Creating custom (S)CSS-code to manipulate $item->introtext

Compared to:

  1. Finding the templatees CSS-files
  2. Creating some CSS code for a already existing .introtext - CSS-class

I definitely prefer the latter case


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31084.

avatar Bakual
Bakual - comment - 14 Oct 2020

I definitely prefer the latter case

Obviously, but it doesn't work for core because you would have to make sure you don't break content by inserting some HTML tags into it. Eg if we add a "" around the introtext it would not work because the text could contain a div or p element. If we however add a div around the introtext, it would add linebreaks which may not be expected.
I don't see how this could be done within core.

If you do it yourself in your template as an override or alternative layout, it's up to you to make sure you don't break anything.

Also, content plugins would almost all break since they only take care of "text" and not "introtext" and "fulltext".

avatar jiweigert
jiweigert - comment - 14 Oct 2020

I get your B/C concerns, but It would be a great step forward to have the ability to differenciate between "introtext" and "fulltext" and as alternative legacy "text" for intro and fulltext combined.

And yes, it will break content-plugins which rely only on "text", but that is something, which could easily be fixed by replacing "text" with "fulltext" in the plugincode or, when Joomla provide a legacy "text" for both, they would still work, right?

OT... Just my personal opinion on B/C breakage, if I have a major version change, i would expect a big B/C break everywhere and prefer that more than expecting that old code still works.

Joomla's decision to prefer B/C compatibility over a consequent redesign of Code to recent code standards and underlying programming language versions is for a major version change a too conservative thinking.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31084.
avatar Bakual
Bakual - comment - 14 Oct 2020

I get your B/C concerns, but It would be a great step forward to have the ability to differenciate between "introtext" and "fulltext" and as alternative legacy "text" for intro and fulltext combined.

I haven't mentioned B/C at all. That's not my concern.

And yes, it will break content-plugins which rely only on "text", but that is something, which could easily be fixed by replacing "text" with "fulltext" in the plugincode or, when Joomla provide a legacy "text" for both, they would still work, right?

You're aware that content plugins are supposed to run on all content, not only articles? So no, plugins should never run on intro and fulltext. That's why they usually run on text so they also work for other extensions.

Imho this feature request is a good example for something that can be done easily with a layout override. It's not hard to do, but you have to take care your content fits for it. All in all something one could write in under an hour, write a documentation and others can even copy-paste it when they need it.

I honestly don't think that is something for core (given the chances of breaking content and plugins).

avatar ReLater
ReLater - comment - 14 Oct 2020

To conclude how easy it is

By experience: You forgot some annoying steps in your list for real life scenarios ;-)

avatar jiweigert
jiweigert - comment - 15 Oct 2020

You're free too add them ;-)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31084.

avatar gostn gostn - change - 8 Nov 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-11-08 13:11:20
Closed_By gostn
avatar gostn gostn - close - 8 Nov 2020
avatar gostn gostn - change - 9 Nov 2020
The description was changed
avatar gostn gostn - edited - 9 Nov 2020
avatar gostn gostn - change - 9 Nov 2020
Title
[4.0] Single Article: Intro-text need different style to body text
[del 31084]
avatar gostn gostn - edited - 9 Nov 2020

Add a Comment

Login with GitHub to post a comment