Search
Other Advanced Module Manager questions
Forum

Modules selection on blog view on article property

Hans H's Avatar Hans H
It a rebound of this question

regularlabs.com/forum/advancedmodulemana...n-certain-categories

I have a blog page with one article ( selction random out of all or the last ect. )
And I want to enable / disable modules basec on this article

I found: forum.joomla.org/viewtopic.php?t=715247
Notice how they use:
<?php foreach ($this->items as $i => $article) : ?>
In this case, you should be able to access the id for each article in the foreach loop by using $article->id

but that is in the template blog render.

is there something like $blog->article[0]->field[32]->rawvalue ???
I did a var_dump print_r on all I know on a page in a module and can't find a clue...

I fixed it for now with a snippet in the article and dump the custom fiel value in a session var and in the PHP selector of AMM I test for that var
$session = JFactory::getSession();
$waarde = $session->get('rechts');
$session->set('rechts', "");
return ( $waarde == 'Uit');

but
return ( $blog->article[0]->field[32]->rawvalue == "Uit"
looks better :-)and dont need a helper snippet in the article

helper snippet with php sourcer
// set var om modules in kolom links en rechts uit te kunnen zetten
$session = JFactory::getSession();
$session->set('rechts', $article->jcfields[30]->value);
$session->set('links', $article->jcfields[31]->value);

Spend a half day on testing and trying so I dare to ast the "master"


UPDATE 20.47
docs3.regularlabs.com/advancedmodulemana...ually-remove-modules
found nice info on this page and fix it with the helper snippet and this code
if ( $article->jcfields[30]->value == "Uit") echo '{remove-modules positions="right"}';
if ($article->jcfields[31]->value == "Uit") echo '{remove-modules positions="left"}';

With a radio button custom field it is easy for the content managers to change the layout
The helper snippet I need any way..

Link ? to sample site...
Confidential information:
(hidden)


If there is a way to get article info from a blog view I still like to know...
Peter van Westen's Avatar Peter van Westen ADMIN
No, the modules cannot access variables created in the blog views. These are not global variables.
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription