Jump to content

Problem with php / joomla module code


tomkilbourn

Recommended Posts

Hello Forum this is my first post here :D

 

I am using a php script (view.default.php) in a Joomla module to display headings which to link to the full articles in my site.

 

Using the Joomla Module Manager, I can select either a one or two-column layout, choose the number of links to display from a category or section, select squared or rounded corners.

 

The problem which I’m having is that the html output for displaying the columns isn't quite right. My php code is outputting HTML with every article link inside a left and right column -

 

<div id="left-column"></div>
<div id="right-column"></div>
<div id="left-column"></div>
<div id="right-column"></div>
<div id="left-column"></div>
<div id="right-column"></div>

I would like the HTML outputted as a single left and a single right column with the article links inside each column as shown here..

 

<div id="left-column">
article link1
article link2
article link3
</div>

<div id="right-column">
article link4
article link5
</div>

This is the php module code I have been using -

 

<?php  

// no direct access  
defined('_JEXEC') or die('Restricted access');  
for ($b = 0; (($this->news_amount - ($b * $this->news_column)) > 0); $b++) {  
for ($c = 0; $c < $this->news_column; $c++) {  

if ($this->news_column == 1) {  
$div_class = 'center_column_class';  } 
elseif ($this->news_column == 2) {  
$div_class = ($c == 0) ? 'left_column_class' : 'right_column_class'; }  
$column = ($b * $this->news_column) + $c;  


//Start Left Column         
if ($c == 0 && $this->news_column > 1) {  
echo '<div id="'.$this->left_module_id.'">'."\n";  
if ($this->leftrounded) {  
echo '<div class="roundedflexable">'."\n";  
echo '<div>'."\n";  
echo '<div>'."\n";  
echo '<div>'."\n";  
if (isset($news_code_html_tab[$column])) {  
echo $news_code_html_tab[$column]; }  
}  

if ($this->leftrounded) {  
echo '</div></div></div></div>'; }  
  
echo '</div>'; }  
//End Left Column 
                  
//Start Right Column 
if ($c != 0){  
echo '<div id="'.$this->right_module_id.'">'."\n";  
if ($this->rightrounded) {  
echo '<div class="roundedflexable">'."\n";  
echo '<div>'."\n";  
echo '<div>'."\n";  
echo '<div>'."\n";  
if (isset($news_code_html_tab[$column])) {  
echo $news_code_html_tab[$column]; }  
}  

if ($this->rightrounded) {  
echo '</div></div></div></div>'."\n"; }  

echo '</div>'."\n"; }  
//End Right Column     

}  
}  

?>  

The link to my site displaying the columns in question is –

 

http://www.tomsspecialreserve.co.uk/joomla

 

Could anybody possibly help me out, I am a total novice when it comes to php and it quickly goes over my head!

 

Thank you

 

 

The link to my site displaying the columns in question is –

 

http://www.tomsspecialreserve.co.uk/joomla

 

There is also a helper.php file and an xml file used in the module. Could anybody possibly help me out, I am a total novice when it comes to php and it quickly goes over my head!

 

Thank you

 

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.