Search
Other Articles Anywhere questions
Forum

if menu="single article" then THIS, else if menu="category blog" then THIS, PLUS default/if empty for both

dee's Avatar dee
Dear Peter,

just purchased PRO version in order to have "if structures", but I can't get to work the following:

Basically I need something like {if menu="single article" then THIS, else if menu="category blog" then THIS} with the additional option to have a default image if both are empty. The latter I could manage with:

<p>{article}[image-fulltext]{if !image-fulltext}<img src="images/header/default.jpg" alt="default-alt" title="default-title" width="1920" height="900" />{/if}{/article}</p>

...but cannot get it to work with the category blog and BOTH inside one statement - is this somehow possible?

All best,
Konstantinos
Peter van Westen's Avatar Peter van Westen ADMIN
You can't do that with the if tags in Articles Anywhere. They are to check article data. So data connected directly to the article.
The menu has nothing to do with the article.

You can do what you want with the help of Conditional Content.
See: regularlabs.com/conditionalcontent
Please post a rating at the Joomla! Extensions Directory
dee's Avatar dee
Thanks for the answer. I managed to solve it this way, in case someone else needs this:

1. For SINGLE ARTICLES incl. showing a default image if none added inside the article, I created a module and placed the following code inside:
<p>{article}[image-fulltext]{if !image-fulltext}<img src="images/default.jpg" alt="" title="" width="1920" height="900" />{/if}{/article}</p>
In "Menu Assignment" I selected "On all pages except those selected" and removed this way the 3 blog category pages.


2. For CATEGORY BLOG incl. showing a default image if none added in the category, I created a module and placed the following code inside:
<p>{article}[category:image]{if !category:image}<img src="images/default.jpg" alt="" title="" width="1920" height="900" />{/if}{/article}</p>
In "Menu Assignment" I selected "Only on the pages selected" and selected only the 3 blog category pages.


Maybe there is a better option for this, but at least for me it works.
Peter van Westen's Avatar Peter van Westen ADMIN
If it works, it works ?

More logical would be:
<p>{article}{if image-fulltext}[image-fulltext]{else}<img src="images/default.jpg" alt="" title="" width="1920" height="900" />{/if}{/article}</p>
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