?
avatar joris85
joris85
3 Dec 2020

Steps to reproduce the issue

/templates/myowntemplate/index.php

php if... ($this->countModules("position1 or position2 or position3")): ?>
<jdoc:include type="modules" name="position1" style="xhtml" />
<jdoc:include type="modules" name="position2" style="xhtml" />
<jdoc:include type="modules" name="position3" style="xhtml" />
en php

Expected result

Load my module :-)

Actual result

Nothing is loaded

System information (as much as possible)

Joomla 4
PHP 7.4

Additional comments

Documentation on Joomla that describes that it should work:
https://docs.joomla.org/Customising_the_way_modules_are_displayed

avatar joris85 joris85 - open - 3 Dec 2020
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Dec 2020
avatar joris85 joris85 - change - 3 Dec 2020
The description was changed
avatar joris85 joris85 - edited - 3 Dec 2020
avatar infograf768
infograf768 - comment - 3 Dec 2020

Try
$this->countModules('position-4') or $this->countModules('position-7') or $this->countModules('position-5')

avatar drmenzelit
drmenzelit - comment - 3 Dec 2020
countModules('position1') || $this->countModules('position2')) : ?>

It is not a bug, it is more a question for the forum. And teh question was posted in Facebook too.

avatar chmst chmst - change - 3 Dec 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-12-03 19:31:59
Closed_By chmst
avatar chmst chmst - close - 3 Dec 2020
avatar chmst
chmst - comment - 3 Dec 2020

Closing this as it is not an issue of Joomla.

avatar joris85
joris85 - comment - 26 Jan 2021

Maybe does not looks like a joomla issue but it works in Joomla 3 and not in Joomla 4.
Works in 80 joomla 3 site's :-)
So i can change this on all my sites on the conversion to J4 but i would say it is still a Joomla issue :-)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31569.
avatar joris85
joris85 - comment - 26 Jan 2021
avatar joris85 joris85 - change - 26 Jan 2021
The description was changed
avatar joris85 joris85 - edited - 26 Jan 2021
avatar joris85 joris85 - change - 26 Jan 2021
The description was changed
avatar joris85 joris85 - edited - 26 Jan 2021
avatar brianteeman
brianteeman - comment - 26 Jan 2021

Not sure why this was closed as it is a documented method to select the modules

avatar Fedik
Fedik - comment - 26 Jan 2021

It is deprecated feature in Joomla 3

Log::add('Using an expression in HtmlDocument::countModules() is deprecated.', Log::WARNING, 'deprecated');

and removed in Joomla 4.

You have to use what @infograf768 suggest.

avatar brianteeman
brianteeman - comment - 26 Jan 2021

Then the documentation needs to be updated and it needs to be added to the faq f deprecated features

avatar Fedik
Fedik - comment - 26 Jan 2021

Yeah, usual problem ;)

avatar joris85
joris85 - comment - 26 Jan 2021

Thanks for the fast support guys!
I will change my code :-)

avatar med-rezzouq
med-rezzouq - comment - 8 Feb 2022

yes actually it is a joomla core issue,

Add a Comment

Login with GitHub to post a comment