Upgrading Site and all extensions to lastest Joomla 2.5. Template Download will be closed for some days

Add Article Title to the Read More Link PDF Print E-mail
Written by Administrator   
Monday, 07 June 2010 09:32
This tutorial will guide you through the steps used to add the Article title to the Read More... link that is displayed in the Joomla! Front Page, Category and Section Blog Layout. You will need to be able to access the file system which houses your Joomla! web site in order to complete this tutorial.

 

First you need to locate your template directory and files. This is located in the templates directory of your Joomla! web site installation, navigate to the templates directory, and then into the directory which contains your template files and subdirectories. Locate the html subdirectory within your template directory, or create the html directory if it does not exists.

Now, within the /templates/your template/html/ directory, locate or create a directory named com_content, and within that directory, locate or create three additional directories named category, frontpage, and section. Once you have located or created the required directories and subdirectories for this tutorial, you should have the following three directory paths available:

/templates/>/html/com_content/category/

/templates/>/html/com_content/frontpage/

/templates/>/html/com_content/section/

Next, you need to locate the following 3 files located in the /components/com_content/views/ directory of your Joomla! web site installation. Within the views directory, locate the subdirectories that match those you created in your template directory (category, frontpage, and section).

Starting with the category directory, copy the file:

/components/com_content/views/tmpl/blog_item.php

To

/templates/>/html/com_content/category/blog_item.php

Next copy the frontpage file:

/components/com_content/views/tmpl/default_item.php

to

/templates//html/com_content/frontpage/default_item.php

And finally, copy the section file:

/components/com_content/views/tmpl/blog_item.php

to

/templates//html/com_content/section/blog_item.php

The last step to add the Article title to the Read more link, is to edit each of the files that you copied into your template directory. Open each of the files you located or created in your Joomla! template directory, and locate the following line of code near the bottom of the file, the line numbers listed are correct for Joomla! version 1.5.14 stock files:

  • Line number 138 in the category/blog_item.php file.
  • Line number 140 in the frontpage/default_item.php and section/blog_item.php files.

echo JText::sprintf('Read more...');

Change the line to look like this:

echo JText::sprintf("Read more... [%s]", $this->item->title);

This will cause your Read more link to display like:

Read more... [Your Article Title Here]

A brief overview of the sprintf statement above, when the code is executed, the %s in the text is replaced with the parameter that follows the quoted text (after the comma). In the example, the parameter is a PHP variable reference to the title of the Article. You do not need to put the square brackets [] in the string, they are just there for example. You can continue to test different configurations for the read more link by modifying the line to suit your needs. Here are a few more examples.

 

echo JText::sprintf($this->item->title);
-> Your Article Title Here

echo JText::sprintf("Read the full text of %s", $this->item->title);
-> Read the full text of Your Article Title Here

echo JText::sprintf("Read more of %s right here!", $this->item->title);
-> Read more of Your Article Title Here right here!

 

If you've followed the steps outlined above, you should now have the Article title displayed with the Read more link in your Joomla! website.


Administrator
Written on Monday, 07 June 2010 09:32 by Administrator

Viewed 5360 times so far.
Like this? Tweet it to your followers!


Newer news items:
Older news items:

Comments (1)Add Comment
0
...
written by I wish it was easyer, August 27, 2010
thanks so much for your info , but i didnt ubderstaend how to do it, can you give some screen shot

tnx

Write comment

security code
Write the displayed characters


busy
Last Updated on Monday, 07 June 2010 09:49
 

Most downloads in 10 days

calendar.gifMay.20

a free Joomla template for travel

calendar.gifAug.01

Today Joomlapanel are pleased to announce the release of  Free JP Dreamland Template, the 5th Te...

calendar.gifMay.23

DS BUSUIT ARRIVED.The waits are finally over. With the long wait for the DS Busuit, now the beta...

calendar.gifJul.31

i-Business is a Joomla 1.5 native template. This is a clean and lightweight template.i-Business a...

Extensions stats

The download archive contains currently 143 downloads in 24 categories. To date, these have been downloaded 137321 times.

Blog Tips

Blog News
SEO Tips

Newest Files

calendar.gifMay.23

This Amazing Template design is delivered with the Following. 18 Module Positions CS...

calendar.gifMay.23

DS BUSUIT ARRIVED.The waits are finally over. With the long wait for the DS Busuit, now the beta...

calendar.gifMar.01

Latest Free Template From Joomvision

calendar.gifMar.01

Today Joomvision are pleased to announce the release of Free JV 9BodyTemplate

Online

We have 419 guests online

If you Are finding premium Joomla templates You should try Template monster


Hosting a Website-Web Hosting Tutorials - Web Hosting Reviews & Guide About Hosting a Website

Latest Comments