|
Friday, 27 November 2009 23:23 |
|
I did several times a simple experiment related to the Joomla template module count. Then, I've just the simple tips to Joomla template placement visits from presence or absence of some or a module position (which published). See this:
<?php if ($this->countModules('left') and $this->countModules('right')) : ?> <!--- function if there are two modules name 'left' and 'right' ---> <?php else: ?> <!--- function if there are NO two modules name 'left' and 'right' ---> <?php endif; ?>
The following logical, comparison and arithmetic operators are available:
| Opr | Example | Description | | + | user1 + user2 | Total number of Modules in user1 and user2 positions. | | - | user1 - user2 | The number of Modules in the user1 position minus the number in the user2 position. | | * | user1 * user2 | The number of Modules in the user1 position multiplied by the number in the user2 position. | | / | user1 / user2 | The number of Modules in the user1 position divided by the number in the user2 position. | | == | user1 == user2 | Returns true if user1 and user2 have the same number of Modules enabled; otherwise returns false. | | != | user1 != user2 | Returns true if user1 and user2 do not have the same number of Modules enabled; otherwise returns false. | | <> | user1 <> user2 | Same as !=. | | < | user1 < user2 | Returns true if user1 has strictly less Modules enabled than user2; otherwise returns false. | | > | user1 > user2 | Returns true if user2 has strictly more Modules enabled than user1; otherwise returns false. | | < | user1 <= user2 | Returns true if user1 has the same or less Modules enabled than user2; otherwise returns false. | | >= | user1 >= user2 | Returns true if user2 has the same or more Modules enabled than user1; otherwise returns false. | | and | user1 and user2 | Returns true if user1 and user2 both have at least 1 enabled Module; otherwise returns false. | | or | user1 or user2 | Returns true if user1 or user2 or both have at least 1 enabled Module; otherwise returns false. | | xor | user1 xor user2 | Returns true if user1 or user2 but not both have at least 1 enabled Module; otherwise returns false. | Note: that if countModules() returns any non-zero number it is equivalent to true; whereas zero is equivalent to false. Reference: http://docs.joomla.org/Operators_for_use_with_the_countModules_function
 |