Jump to content

help with multi-conditional


Erjati

Recommended Posts

I'd be grateful if you can sort this out. I don't know php but I'm modifying a Joomla template that uses it. I need to correct the following code so that it writes the div tag based on conditions.

 

Lines 1, 2 and 3 are my attempt to patch together code from the rest. Lines 4 and after are correct and from the original template. I need my first 3 lines to write the div tag on line 2 if the module count in 'left' and 'right' are both zero. As is the site throws the error: Parse error: parse error, unexpected T_LOGICAL_AND. If I take out the and it says: Parse error: parse error, unexpected ')'

 

<?php if($this->countModules('left')<1) and ($this->countModules('right')<1) and JRequest::getCmd('layout') != 'form') :?>
<div id="maincolumn_fullwidth">
<?php else: ?>
<?php if($this->countModules('right') and JRequest::getCmd('layout') != 'form') : ?>
<div id="maincolumn_small">
<?php else: ?>
<div id="maincolumn_medium">
<?php endif; ?>

 

I would also like this to write div id="maincolumn_medium" if the left count is zero AND the right count is greater than zero. If the count is greater than zero for both left and right the div tag needs to read div id="maincolumn_small", which it does now, but wont let me have modules on the right alone with left at zero modules. With the original lines 4-8 if there is a module on the right it will make the main column small.

 

Note: the purpose of this code is to write the correct div id so the css will set the width of the main column correctly, based on whether there are modules on the left, right, both or neither.

 

Thank you for your help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.