Page 1 of 1

category blog format (intro columns)

Posted: Fri Feb 08, 2008 9:03 pm
by afrenyo
hi there,

as it stands, i have only been able to apply two columns to a category blog layout (through its calling menu item) in such a way that the article intros get listed all the way down on the left, then continue on top of the next column.

ex.
+column1
-article1
-article2
-article3

+column2
-article4
-article5
-article6

is there a way to make the intros go left to right in a row across columns, then continue down to the next row?

ex.
+column1
-article1
-article3
-article5

+column2
-article2
-article4
-article6

Thanks.

Re: category blog format (intro columns)

Posted: Tue Apr 15, 2008 6:43 am
by NikonUser
Did you find an answer to this problem? I am experiencing the same thing and would love to change it.

Paul

Re: category blog format (intro columns)

Posted: Tue Apr 15, 2008 5:27 pm
by DB5
me aswell! thanks!

Re: category blog format (intro columns)

Posted: Tue Apr 15, 2008 11:33 pm
by afrenyo
No, I'm afraid no one has been able to help me out.

Re: category blog format (intro columns)

Posted: Wed Apr 16, 2008 5:28 am
by NikonUser
Apparently a Template Override will do the trick.

I have very little programming knowledge but I will see if I can work something out over the next few days.

I'm really surprised this isn't a bigger issue. Maybe we are missing something?

Paul

Re: category blog format (intro columns)

Posted: Wed Apr 16, 2008 9:06 am
by NikonUser
I'm really hoping someone with some knowhow will chime in here. I am trying my best but my programming knowledge is very limited. Especially when it comes to all the Joomla variables and such.

I have modified the
->componants->com_content->section->tmpl->blog.php

and tried to use it as a template override by putting it in

->MYTEMPLATE->html->com_content->section->blog.php (this will only modify the blog layout of a section to do a category you will need to put the file in ->category->blog.php)

Here is the code I am using. It's not even nearly perfect (it uses tables, still not completed) but it is a starting point that maybe someone (along with me playing around) can work on.

EDIT: SEE THE POST BELOW FOR UPDATED CODE (COPY/PASTED FROM ACTUAL JOOMLA CODE)

Re: category blog format (intro columns)

Posted: Wed Apr 16, 2008 9:21 am
by NikonUser
UPDATE:

I just had a thought (rare for me)... Since the layout on the front page works from left to right I could steal the code used in: (only the bit that arranges the articles)

->components->com_content->frontpage->tmpl->default.php

as a template override. This achieves exactly what I was trying to do before but with code made by the Joomla team (which is much better than my code!!!). So this should now work perfectly. I will attach the file that you need to upload as a template override.

Code: Select all

<?php
defined('_JEXEC') or die('Restricted access');
$cparams =& JComponentHelper::getParams('com_media');
?>
<?php if ($this->params->get('show_page_title')) : ?>
<div class="componentheading<?php echo $this->params->get('pageclass_sfx');?>">
	<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<table class="blog<?php echo $this->params->get('pageclass_sfx'); ?>" cellpadding="0" cellspacing="0">
<?php if ($this->params->def('show_description', 1) || $this->params->def('show_description_image', 1)) :?>
<tr>
	<td valign="top">
	<?php if ($this->params->get('show_description_image') && $this->section->image) : ?>
		<img src="<?php echo $this->baseurl . '/' . $cparams->get('image_path') . '/'. $this->section->image;?>" align="<?php echo $this->section->image_position;?>" hspace="6" alt="" />
	<?php endif; ?>
	<?php if ($this->params->get('show_description') && $this->section->description) : ?>
		<?php echo $this->section->description; ?>
	<?php endif; ?>
		<br/>
		<br/>
	</td>
</tr>
<?php endif; ?>
<?php if ($this->params->def('num_leading_articles', 1)) : ?>
<tr>
	<td valign="top">
	<?php for ($i = $this->pagination->limitstart; $i < ($this->pagination->limitstart + $this->params->get('num_leading_articles')); $i++) : ?>
		<?php if ($i >= $this->total) : break; endif; ?>
		<div>
		<?php
			$this->item =& $this->getItem($i, $this->params);
			echo $this->loadTemplate('item');
		?>
		</div>
	<?php endfor; ?>
	</td>
</tr>
<?php else : $i = $this->pagination->limitstart; endif; ?>

<?php
$startIntroArticles = $this->pagination->limitstart + $this->params->get('num_leading_articles');
$numIntroArticles = $startIntroArticles + $this->params->get('num_intro_articles', 4);
if (($numIntroArticles != $startIntroArticles) && ($i < $this->total)) : ?>
<tr>
	<td valign="top">
		<table width="100%"  cellpadding="0" cellspacing="0">
		<tr>
		<?php
			$divider = '';
			for ($z = 0; $z < $this->params->def('num_columns', 2); $z ++) :
				if ($z > 0) : $divider = " column_separator"; endif; ?>
				<?php
				    $rows = (int) ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns'));
				    $cols = ($this->params->get('num_intro_articles', 4) % $this->params->get('num_columns'));
				?>
				<td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>">
				<?php 
				$loop = (($z < $cols)?1:0) + $rows;
				
				for ($y = 0; $y < $loop; $y ++) :
					$target = $i + ($y * $this->params->get('num_columns')) + $z;
					if ($target < $this->total && $target < ($numIntroArticles)) :
						$this->item =& $this->getItem($target, $this->params);
						echo $this->loadTemplate('item');
					endif;
				endfor; 
				?>
				</td>
		<?php endfor; ?>
		<?php $i = $i + $this->params->get('num_intro_articles') ; ?>
		</tr>
		</table>
	</td>
</tr>
<?php endif; ?>
<?php if ($this->params->def('num_links', 4) && ($i < $this->total)) : ?>
<tr>
	<td valign="top">
		<div class="blog_more<?php echo $this->params->get('pageclass_sfx') ?>">
			<?php
				$this->links = array_splice($this->items, $i - $this->pagination->limitstart);
				echo $this->loadTemplate('links');
			?>
		</div>
	</td>
</tr>
<?php endif; ?>

<?php if ($this->params->def('show_pagination', 2)) : ?>
<tr>
	<td valign="top" align="center">
		<?php echo $this->pagination->getPagesLinks(); ?>
		<br /><br />
	</td>
</tr>
<?php endif; ?>
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<tr>
	<td valign="top" align="center">
		<?php echo $this->pagination->getPagesCounter(); ?>
	</td>
</tr>
<?php endif; ?>
</table>

[YOUR TEMPLATE]->html->com_content->section->
[YOUR TEMPLATE]->html->com_content->category->

(choose one or both of the above depending on what your needs are)

This works perfectly for me. I hope it works for someone else having trouble as well.

Paul

Re: category blog format (intro columns)

Posted: Thu Apr 24, 2008 2:21 pm
by dwizer
I have the same problem..

Hmm i'm not following :( Where to put that code? What file?

Maybe a stupid question but i'm new to Joomla and don't have any coding experience =( So maybe you can write a step by step guide for a newbie? Because this is really annoying when you have a lot of pages with articles that needs to be sorted in the right way ;)

Thanks / Mats

Re: category blog format (intro columns)

Posted: Sat Apr 26, 2008 1:01 am
by ando66
It would be great to fix this problem! But I also don't know how to do this (i.e what file, what name etc) ... I'm using a template I made myself so don't have any template overrides at all.

Re: category blog format (intro columns)

Posted: Sat Apr 26, 2008 1:44 am
by ando66
nikonuser is a frigging genius!

Worked it out with a bit of trial and error ... All you do is as he mentions, cut and paste his code into a file called blog.php and save it to

[YOUR TEMPLATE]->html->com_content->category->

And that it - it works like a dream ... I'm guessing saving that file to

[YOUR TEMPLATE]->html->com_content->section->

Would work also for sections ....

I'm using a custom template without lots of frills etc, very basic, and I didn't need to touch any other part of the template, I just created those 2 files... too easy

Worked for me on joomla 1.5.3 ..... THANKS NIKONUSER!!!!!!!!!!

Re: category blog format (intro columns)

Posted: Sat Apr 26, 2008 9:23 am
by dwizer
Ah now i understand :) Works perfect..

So you have to CREAT the directories /html/com_content/category/ inside your template dir and put the blog.php inside :) I was looking for the directories but didn't found them so i thought something was wrong or that it wouldn't work with just MY template..

Stupid how blind you can be sometimes :P I hope all newbies like myself, can fix this now!

Maybe someone can tell the mighty joomla coders about this problem if its not already done?

Thank u, thank u :)) you are my hero!

/ Mats

Re: category blog format (intro columns)

Posted: Sat Apr 26, 2008 12:26 pm
by humvee
Unfortunately it seems whilst this matter was reported Tracker 10691 - someone somewhere has decided that correct historical means of reading - left to right and then down the page, left to right - does not apply to Joomla! and has therefore been dismissed out of hand as something for Webmasters to fix!!

Andy

Re: category blog format (intro columns)

Posted: Fri May 09, 2008 8:12 am
by kurtroesand
I'm baffled that Joomla does this. :eek:

How hard could it be for the Joomla developers to add an option in the 'Parameters - Basic' panel so that the users can select 'left to right' or 'top to bottom' reading?

Re: category blog format (intro columns)

Posted: Sat Dec 27, 2008 12:46 am
by greyham
I've noticed this too; If I have the default category blog layout settings with only 3 articles in the category, I get one article at the top and a column on the left with the other two, and a big empty column on the right. Does anyone know whether this issue is going to be fixed in the core, or are we going to have to hack templates?

Re: category blog format (intro columns)

Posted: Mon Nov 30, 2009 11:37 am
by scoobysue
Hi, I was just reading this and I know it is late - but you can control this under the menus
Go the menu link which is for the category blog you are listing.
In the parameters under ADVANCED
it states Multi column order Across or Down
make sure you click ACROSS
this will mean you will get the articles reading across and down rather than down.

;)

Re: category blog format (intro columns)

Posted: Mon Dec 14, 2009 7:38 am
by joomfriend
scoobysue wrote:Hi, I was just reading this and I know it is late - but you can control this under the menus
Go the menu link which is for the category blog you are listing.
In the parameters under ADVANCED
it states Multi column order Across or Down
make sure you click ACROSS
this will mean you will get the articles reading across and down rather than down.

;)
Better late than never. Thanks very much for the tip. It helps. I was trying to figure out how to have articles reading across and down. I knew it was possible from the backend without any hack but i couldn't find my way.

Many thanks

Re: category blog format (intro columns)

Posted: Wed Mar 17, 2010 11:57 am
by wangbia
Better late than never. Thanks very much for the tip. It helps. I was trying to figure out how to have articles reading across and down. I knew it was possible from the backend without any hack but i couldn't find my way.

Many thanks[/quote]

I've worked this solutions in and out every way possible and still do not have success with 3 or 4 columns reading across then down on a category/blog page.

Neither did the above provided template over ride.

I'm using v. 1.5.15 and wonder if changes in that latest version are causing the problem.

I am not enough of a php programmer to be able to decipher it.

Still looking for help... :( ???

Re: category blog format (intro columns)

Posted: Tue May 04, 2010 3:22 am
by nooblarama
Yeah same problem as wangbia on 1.5.15.
doesnt matter what you change in the category blog layout of a menu item, it stays as one header and one column with 2nd 3rd 4th articles streaming down the left side column and a big empty right column.
sighs...

Re: category blog format (intro columns)

Posted: Mon Oct 11, 2010 1:03 pm
by jsh123
Seems this also is an issue in Joomla 1.5.20..

Only one column..

Re: category blog format (intro columns) WITHOUT columns

Posted: Mon Jan 16, 2012 8:37 pm
by antaraflo
Hello, I came here looking for a solution for editing the categories default columns, because I needed just one .

The code that i´m using to do this is:

Code: Select all

	
              <?php
         $divider = '';
         for ($z = 0; $z < $this->params->get('num_columns'); $z ++) :
		    if ($z > 0) : $divider = " column_separator"; endif; ?>
            <td valign="top" width="1000px" class="article_column">
            <?php for ($y = 0; $y < ($this->params->get('num_intro_articles')); $y ++) :
			   if ($i < $this->total && $i < ($numIntroArticles)) :
                  $this->item =& $this->getItem($i, $this->params);
                  echo $this->loadTemplate('item');
                  $i ++;
			   endif;
			endfor; ?>
            </td>
      <?php endfor; ?>
       
The file is in: "<your joomla! home>components/com_content/views/category/tmpl/blog.php


Create the override directory for the Category Blog as follows: "<your joomla! home>/templates/<your template>/html/com_content/category/blog.php

I attach the entire override blog.php also.


Hope that helps to somebody!