In the past we needed to do a core hack, but I spent some time and figured out how to make the Full Text display in the Content Blog Layout using only Template overrides.

Firstly we need to fix something I believe to be a mistake so that we can show or hide the intro text on the blog view.

Open your template override file for category blogs

templates/[template name]/html/com_content/category/blog_item.php

Find:

<?php if (!$params->get('show_intro')) : ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php endif; ?>

Changed to (Notice the ! removed before the $params to fix this – I have also removed this in templates/[template name]/html/com_content/article/default.php)?

<?php if ($params->get('show_intro')) : ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php endif; ?>

Then we need to add

<?php echo $this->item->introtext; ?>

like so:

<?php if ($params->get('show_intro')) : ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php echo $this->item->introtext; ?>
<?php endif; ?>

Now we can hide the intro text if wanted to or show it alone.

Now lets get the full text to display

Open your template override file for category blogs

templates/[template name]/html/com_content/category/blog_item.php

find:

JHtml::core();
?>

Or if you cant find that line – just find the first php close tag – ?> – in that file as you will want to add the piece of php below the first php tag and not inside it

After that add this new php statement:

<?php
	$itemID =  $this->item->id;
	$db =& JFactory::getDBO();
	$query = "
	SELECT `fulltext` 
	FROM `#__content` 
	WHERE `id` = $itemID;
	";
	$db->setQuery($query);
	$fulltext = $db->loadResult();
?>

Now -Logically ¨C if you have read more shown you wont need full text.. so lets make it work in the following way:

– if read more is shown, fulltext is not

– if read more is hidden fulltext is shown

Find and remove: (Not the one you added in the top but one more to the bottom)

<?php echo $this->item->introtext; ?>

Then Find near the bottom of the file:

<?php endif; ?>
<?php if ($this->item->state == 0) : ?>

Then add before the endif:

<?php else : ?>
<?php echo $fulltext; ?>

The result should look like this:

<?php else : ?>
<?php echo $fulltext; ?>
<?php endif; ?>
<?php if ($this->item->state == 0) : ?>

Now your Joomla will be able to show full text in the Content Blog layout, it will show the full text when read more is hidden, and only the read more link when it is is shown, and intro text can be displayed or hidden.

You could also apply this same method to you featured article file

templates/[template name]/html/com_content/featured/default_item.php

or just about anywhere you need it

How To: Joomla 1.7 , 2.5 Full Text In Category Blog Layout – Template override
Tagged on:                                                 

Leave a Reply

Your email address will not be published. Required fields are marked *

42 thoughts on “How To: Joomla 1.7 , 2.5 Full Text In Category Blog Layout – Template override

  • Hi DieSkim,

    Very interesting thread. I have been looking for a way to show full text in the category blog. I am using Joomla 3.1.5 and the code is quite different from your example above. Do you have time to check out the fix for this version. I’m not a PhP programmer, so I’m looking for a pretty exact fix. Thank you so much!

    Cheers,
    Dan

    1. Hi Dan,

      Sorry since Joomla 3 is not a long life release yet I have not looked much at it yet. Once I have to upgrade I will and then look into this and update this post! Sorry but I do not have the time now!

  • finally i found someone who knows how to provide relevant information on the subject i have been searching for? thanks, at last i can study with pleasure..

  • OMG Thank You! I was upgrading my portfolio website from Joomla 1.5.x to Joomla 2.5.9 and desperately needed this functionality.

    Got it working in just a few minutes with Joomla 2.5.9

    Thank you very much!

    1. Hi Scot! I am glad that my post helped! I am still using Full text Blog Layout every day on multiple Joomla sites so I will still keep it updated for a while! Let me know if you have any other Joomla questions or needs!

    1. Hi! Please explain exactly what you need? There are many easy ways to override com_content – let me know and I will look at what I can do to help!

  • Hi DieSkim,
    sorry for my possibly bad english. I haven’t used it for a while.
    Searching for a way to show the leading articles in a blog as full articles your way described here helped me a lot.
    Thank you very much.
    It works with Joomla 2.5.7 for me.
    If I’ve made it I want to publish the way with a reference to your article if it’s allowed.
    It’ll take some time, ’cause I’m on a rebuild.
    Thank you again.

    1. Hi Jörg,

      I am glad my blog helped you show leading articles in a blog as full articles!
      I am also glad you got it working in Joomla 2.5.7!

      Yes, please feel free to publish it on your blog or where ever you want with a reference to my blog.

      Let me know if you need help with anything else!
      DieSkim

  • Hello, I am trying to migrate a Joomla 1.5 to Joomla 2.5 and on all the menu pages of the category blog type I cannot see any of the articles(Not the intro and not the full text – nothing).
    Is this something that is related to what you wrote here?

    Miki

    1. Hi Miki,

      Glad you found my blog! I ran into this problem once before, try to do a complete re-install of a the complete Joomla 2.5 package over what you have now.

      Make sure to have backups before you do this of the original 1.5 site and also the new broken 2.5 site.

      A good tool for backups is Akeeba Backups and Akeeba Admin tools is great for upgrades.

      Let me know if you need any help!

      Peace

  • Hi again!
    2.5.7 today, i did repeat the operation with the 2 new files, eveything seems ok. Only one thing : the line JHtml::core(); disappeared… Let us know and thanks again!

    1. Thanks for letting me know – what theme did you check this on?? You would not really need to redo this after an update if you do it in you own theme`s overwrite files and not in one of the default themes!

      1. Hi! it was the first time these two files (default & blog_item) were replaced, since i done it. I imagine that with the new files version of Joomla, it would be better to replace them (in /html) and hack again with your process, am i wrong??

        1. Well if those files where updated in your template then yes it would be best to use the new files and apply the hack again.

  • Hi,
    Thank you for the explanation. However, it isn’t working in my case. Probably, because I am using joomla 2.5.6. Can you pleae help me?
    Is there maybe a possibility that we can have contact by email?

    Thank you in advance

  • Hello, nice work. I have one problem.
    I use Sig Pro (Joomlaworks). This plugin doesn’t work with this override in the fulltext. It looks like {gallery}…{/gallery}.
    What do I wrong?

    1. Matthias. I am glad my Guide on how to enable Full Text in Joomla`s Blog View helped you. As for you problem – I believe its a Joomlaworks issue, you would need to contact them and ask them for some help. Let me know if you are not able to get any info from them.

  • I want to implement the ability to “How To: Joomla 1.7 , 2.5 Full Text In Category Blog Layout – Template override” but I’m not finding the exact locations to make the modifications to the Joomlashack Optimus template and I don’t know html. I’m not comfortable making the changes unless it matches your approach exactly. I would appreciate your thought. Thanks

    1. Steve, I have not used this to enable Full Text In Category Blog Layout in the Joomlashack Optimus template – you might need to speak to them about how to implement it. If you however have no HTML or PHP knowledge I would think it would be a bit hard. Let me know if you are not able to get the Joomlashack guys to help you, then I can have a look for you!

    1. Hi, I am sorry I dont fully understand what you need? Do you need a extension that can create full article view in blog layout?

    1. Great! I am glad it works for you! I use it on a live site so I know it works every day! Let me know if you have any trouble with it!