I am not able to use data from Article Anywhere in a PHP IF or SWITCH.
The following is PHP code inside {articles}{/articles}.
Example:
$category = '[category-id]';
if ($category == 10) {
DO SOMETHING
} else {
DO SOMETHING OTHER
}
i tried to change the $category variable cast turning it into numbers but nothing,
or with a switch with CATEGORY-ALIAS data:
$category = '[category-alias]';
switch ($category) {
case 'category-1':
DO SOMETHING
break;
case 'category-2':
DO SOMETHING
break;
}
i can see the changing values for every article into {articles} when echo the variable, it seems a string, but i can't use it and i can't match the category-alias into my php switch.
I've lost one day of trials: how i can i get a "clean" value from article anywhere to put into my php code?
So, in this specific case i'm using it on a module that allows HTML, PHP and Javascript codes (Flexi Custom Code).
If i remember correctly i used something similar code somewhere else (maybe directly in a php file?), but in this case there's no possibility to make it working in that way (inside a module that makes an article header), i lost over a day in trials.
Confidential information:
(hidden)
I solved with Article Anywhere conditional content (i needed to assign to a DIV some classes in function of CATEGORY-ID and language --get by php from Joomla $language = JFactory::getLanguage(); $language = $lingua->getLocale()[4];--).
Article Anywhere is a GREAT extension, i can mix HTML, PHP and ARTICLE ANYWHERE tags to make Joomla incredibly powerful!
I mixed them with satisfaction inside modules and articles layout overrides making complex websites.