Content Category Blog Layout - Div bug

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
ipimen
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Thu Apr 27, 2006 4:16 pm

Content Category Blog Layout - Div bug

Post by ipimen » Sun Jul 20, 2008 5:27 am

Hello...i think i found a div bug with the beez template when you create a Menu Item with Category Blog Layout.

The original code in the file templates/beez/html/com_content/category/blog.php from line 50 is:

Code: Select all

		for ($y = 0; $y < $rowcount && $i < $this->total; $y++) : ?>
			<div class="article_row<?php echo $this->params->get('pageclass_sfx'); ?>">
				<?php for ($z = 0; $z < $colcount && $ii < $introcount && $i < $this->total; $z++, $i++, $ii++) : ?>
					<div class="article_column column<?php echo $z + 1; ?> cols<?php echo $colcount; ?>" >
						<?php $this->item =& $this->getItem($i, $this->params);
						echo $this->loadTemplate('item'); ?>
					</div>
					<span class="article_separator">&nbsp;</span>
				<?php endfor; ?>
				<span class="row_separator<?php echo $this->params->get('pageclass_sfx'); ?>">&nbsp;</span>
			</div>
		<?php endfor;
I don't know where it comes from, but when the code is executed, just before the closing div after echo $this->loadTemplate('item'); ?>, i find an opening <div> that causes the html to look like the screenshot on the attachment Figure 1. As you can see the <div class="article_row> are nested and this causes the footer to be wrongly placed. I want the footer to be just after <div id="all">, but with that strayed div the footer is inside <div id="all">, and the more articles i publish, more strayed divs and the footer gets placed deeper and deeper.

So i thought, if i have a strayed openning div, let's put a closing div right next where it is placed and i changed the code above to this:

Code: Select all

		for ($y = 0; $y < $rowcount && $i < $this->total; $y++) : ?>
			<div class="article_row<?php echo $this->params->get('pageclass_sfx'); ?>">
				<?php for ($z = 0; $z < $colcount && $ii < $introcount && $i < $this->total; $z++, $i++, $ii++) : ?>
					<div class="article_column column<?php echo $z + 1; ?> cols<?php echo $colcount; ?>" >
						<?php $this->item =& $this->getItem($i, $this->params);
						echo $this->loadTemplate('item'); ?>
					</div></div>
					<span class="article_separator">&nbsp;</span>
				<?php endfor; ?>
				<span class="row_separator<?php echo $this->params->get('pageclass_sfx'); ?>">&nbsp;</span>
			</div>
		<?php endfor;
Figure 2 is the resulting code when it is executed, as you can see just after <h2 class="contentheading"> there's an empty div block, this is the one opened by the strayed div and closed by the div I added on the code above. You can also notice on this figure that the <div class="article_row> are at level and, even if it is not shown on the image, the footer is placed where i want.

I have tried to trace this div that has no closing, but i can't find where it comes from. I have read several posts about div bugs and they are all problems related to the hmtl in an article, this is not the case since i am only showing the title of the articles.

Is this a bug or a mistake of mine somewhere? Please help as i don't like the solution i found, it is blunt force and i'm not sure what problems it could cause somewhere else.

Thanks in advance for your patience and help.
You do not have the required permissions to view the files attached to this post.

gibilix
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Apr 05, 2009 3:30 pm

Re: Content Category Blog Layout - Div bug

Post by gibilix » Sun Apr 05, 2009 3:33 pm

I have the same problem. Adding the extra </div> solves on one page, but breaks another, apparently configured in the same way.

I haven't found a solution yet.

glimbeek
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 146
Joined: Wed Mar 25, 2009 8:08 am
Location: Europe

Re: Content Category Blog Layout - Div bug

Post by glimbeek » Fri Aug 07, 2009 6:50 am

Don't know if you guys still needed a solution to the problem, I had same thing for IE6 and I solved it by doing the following.

File: position.css

to the class:
.article_row
{
margin: 0px 0 0px 0;
padding: 0;
overflow: hidden;
}

add: clear: both;

Seems to be working.

left23
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Fri Sep 25, 2009 1:51 pm
Location: Ireland
Contact:

Re: Content Category Blog Layout - Div bug

Post by left23 » Tue Jul 13, 2010 3:25 pm

Any developments on this front?

I'm having the same issue and despite a few hours of researching, I haven't come across any solutions...

Anyone find one?!

TheoFontane
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Feb 11, 2012 11:26 pm
Location: Wiesbaden
Contact:

Re: Content Category Blog Layout - Div bug

Post by TheoFontane » Sat Feb 11, 2012 11:35 pm

This problem still occurs in Joomla version 1.7.2.
When using the "blog" layout, it creates an open DIV at the end - so my footer is now in the content-div and therefore not in place.

I can't believe there is no bugfix or at least an answer to this post since 2009...

Does anyone know a workaround/bugfix for this?

leftside
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat Jul 28, 2012 2:27 am

Re: Content Category Blog Layout - Div bug

Post by leftside » Sat Jul 28, 2012 2:32 am

I had to put 3 closing div tags at the end of templates/your_template/html/com_content/category/blog.php but got it working. Pretty annoying really - this problem has been around for ages

ladne_rzeczy
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Dec 11, 2012 11:54 pm

Re: Content Category Blog Layout - Div bug

Post by ladne_rzeczy » Wed Dec 12, 2012 12:02 am

hi there,

I'm using Joomla 2.5 and still - I found the same problem - never solved since 2008 - that's a shame. Really, no response?
I haven't found any patch to fix it, not a single useful piece of advice..

I've made my own changes in blog.php file and I hope my advice will be usefull:

at the end of the file add this code:

Code: Select all

<?php if($rowcount >= count($this->intro_items)): ?>
</div>
<?php endif; ?>
It should generate closing tag depending on if the one that was creating a problem was already generated.

Please, let me know if it works for you.

inovoke
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Oct 11, 2009 11:47 pm

Re: Content Category Blog Layout - Div bug

Post by inovoke » Wed Jul 17, 2013 4:13 am

Thanks to ladne_rzeczy for pointing me in the right direction, though the solution provided caused problems with other layouts in Joomla 3.11. By adding a </div> at line 77 of blog_item.php (in com_content, views, category, tmpl folders) I was able to fix the problem (I hope). It was an issue with the Read More button.

MNaderian
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Jun 09, 2015 10:15 am

Re: Content Category Blog Layout - Div bug

Post by MNaderian » Tue Jun 09, 2015 10:30 am

Hi guys.

I've been dealing with this problem since my first use of Category Blog component. The problem rises when you include a "Div" tag into your intro text! But don't worry, cause there's a really simple solution.

Here's the solution:

1. Go to this folder in your home directory: components/com_content/views/category/tmpl

2. Open file named "blog_item.php" to edit it.

3. Find the line containing this code:

Code: Select all

<?php echo $this->item->introtext; ?>
4. Replace it with this:

Code: Select all

<?php echo str_replace("div", "p", $this->item->introtext); ?>
5. Save the file and close it.

6. Problem solved! ;)


*Note: If you wanna have this problem always solved, it's better to do some layout override. Just go to your template folder and in "html" folder make "com_content" directory and inside of it make "category" and include a copy of the file "blog_item.php" and then edit it as told above.

wish you happy times. :pop


Locked

Return to “Templates for Joomla! 1.5”