Include Content Item plugin

This plugin allows you to insert or include one content item into another content item.

Inserting a content item is as simple as {include_content_item 123},
where 123 is the ID of the content item to be included.
Note: The ID of the respective content item is listed in the Content Items Manager (or Article Manager in Joomla 1.5).

This is useful, for example, when you have a block of text that you want to appear across a number of articles or content items e.g. download instructions, copyright notice, images, common links/resources, etc.

Available for all Joomla versions: Joomla 1.0.x, native 1.5.x, 1.6.x, 1.7.x, 2.5.x and 3.0.x!

The latest version now supports nested include! Details here,


Latest Version

v1.0.11 (for Joomla 1.0), v1.5.11 (for Joomla 1.5), v1.6.11 (for Joomla 1.6), v1.7.11 (for Joomla 1.7), v2.5.11 (for Joomla 2.5), v3.0.12 (for Joomla 3.0)
Released Jun 3, 2014

Native version of the plugin for Joomla 3.3.0 is now available!

Special thanks to Jörgen @ Kreativ Fotografi for contributing to the code. Details here.

Also touched up some codes so that jQuery functions work with Joomla 3.3 (used in the readmore/fadein function)

How to use the "Include Content Item" plugin

  1. To include a content item, use the syntax {include_content_item 123}
    where 123 is the ID of the content item to be included. Note that both the intro and the fulltext will be included.
  2. To include only the intro a content item, use the syntax {include_intro 123}.
  3. To include only the fulltext (or maintext) of a content item, use the syntax {include_fulltext 123}.
  4. To add the title of the included article: {include_content_item 123 1}
  5. To add the title and link to the included article: {include_content_item 123 1 1}
  6. The ID of the respective content item is listed in the Content Items Manager (or Article Manager in Joomla 1.5).
  7. It is not necessary to publish the content item that will be included.
  8. If you have installed the DirectPHP plugin, you can also store frequently used PHP code snippets in a content item. This can then be included into other content items. Note: Please make sure that in the Mambot/Plugin Manager, this plugin comes before the DirectPHP plugin so that this plugin is being processed first, followed by DirectPHP.

Displaying the Read More link

There are several options to display the Read More link:

  1. When you use the tag
  2. {include_content_item 123 readmore=1}

    the intro text will be displayed, followed by the default "Read More" as defined by your template. Note that if there is no text in the main text, there will be no "Read More" link displayed.


  3. If you do not like the default "Read More" link, you can specify your own text to be displayed for the "Read More" link with the tag
  4. {include_content_item 123 readmore='[Read More]'}

    Important: Please make sure you put single quotation marks surrounding the text.

  5. If you have specified you your own text to be displayed for the "Read More" link, you can set the css style to be used with the tag
  6. {include_content_item 123 readmore='View Full Article...' class=style1}

  7. Instead of text, you can also specify an image to be displayed for the "Read More" link with the tag
  8. {include_content_item 123 readmore_gif='/url/of/your/image/file'}

    Important: Please make sure you put single quotation marks surrounding the url of the image file.

    Although it says "readmore_gif", you can use any browser supported image format such as jpg or png.

    You can also add the parameter align=top, align=middle or align=bottom to align the image:

    {include_content_item 123 readmore_gif='/url/of/your/image/file' align=top}

  9. For some template (e.g. the default Joomla 1.5 template rhuk_milkyway), it is necessary to have a <br clear=all> after the Read More link. For such cases, add the parameter br=1:
    {include_content_item 123 readmore=1 br=1}
    {include_content_item 123 readmore='[Read More]' br=1}
    
  10. If you need a <br clear=all> before displaying a "Read More" image (for example, if you want to have the image aligned to the left), add the parameter br_before=1:
  11. {include_content_item 123 readmore_gif='/url/of/your/image/file' br_before=1}

Nested Include

The Include_Content_Item plugin now supports nested include!

That is, if you have article A that includes article B, which has a include of article C, both B and C will now be included in A.

  • There is also a safety check for cyclic include, i.e. if article A includes article B, which has a include of article A. In this case, all duplicate entries will not be displayed.
  • If you do not want any nested include, use the following:
  • {include_content_item 123 readmore=1 nested=0}
    
  • If you want the nested include to stop at level 2, use the following:
  • {include_content_item 123 readmore=1 level=2}
    

Allow Multiple Includes of the Same Article

The Include_Content_Item plugin now allows you to include the same article for more than once.

In the previous version, by default, an article will be allowed to include only ONCE per article.

With this version, to include, say article id 123, 3 times in the same article, use the following:

{include_content_item 123}
{include_content_item 123 allow_multiple=1}
{include_content_item 123 allow_multiple=1}

Note the use of the flag allow_multiple=1 for the 2nd and 3rd time - otherwise these 2 tags will be ignored.

Display of Fulltext using Fade-in

If you use the default Joomla "Read More" link, when the user clicks on the link, Joomla will divert the user away from the current page and display the full article.

If you would like the user to stay on the same page, use the fade-in option. When the user clicks on the "Read More" link, the fulltext (or maintext) will be displayed as fade-in right inside the same page (without any reloading of page).

{include_content_item 123 readmore=1 fadein=1}

There are three ways to display the fadein:

  • As a text link:
  • Sample 1: Click the ReadMore link to display the full article...
    [Read more...]

    You are now viewing the "fulltext" portion of the article.

    Here's the tag for this this one:

    {include_content_item 123 readmore=1 fadein=1}


    You can set the text label for the ReadMore links, for example, you might want to set this to your own language. Note that you need to define the text labels for both the show and hide link. The text labels are delimited by '|' (the vertical bar). Please also enclose these in single quotes (NOT double qutoes).

    Sample 2: Click the ReadMore link to display the full article...
    Your ReadMore Link >>>

    You are now viewing the "fulltext" portion of the article.

    Here's the tag for this this one:

    {include_content_item 123 readmore='Your ReadMore Link >>>|Your HideDetails Link >>>' fadein=1}


    To use your own style for the ReadMore link, use the following. Don't forget to define the style your_style in your template.

    {include_content_item 123 readmore='Your ReadMore Link >>>|Your HideDetails Link >>>'
    fadein=1 class=your_style}
  • As an image link:
  • Sample 3: Click the ReadMore image link to display the full article...


    You are now viewing the "fulltext" portion of the article.

    Here's the tag for this this one:

    {include_content_item 123 readmore_gif='url_of_readmore_img.gif|url_of_hide_img.gif' fadein=1}


    To use your own style for the ReadMore image link, use the following. Don't forget to define the style your_style in your template.

    {include_content_item 123 readmore_gif='url_of_showmore.jpg|url_of_hidetails.jpg'
    fadein=1 class=your_style}
  • As a button:
  • Sample 4: Click the ReadMore button to display the full article...

    You are now viewing the "fulltext" portion of the article.

    Here's the tag for this this one:

    {include_content_item 123 readmore=1 type=button fadein=1}


    As in text link, you can set the text label for the ReadMore/Hide buttons:

    Sample 5: Click the ReadMore button to display the full article...

    You are now viewing the "fulltext" portion of the article.

    Here's the tag for this this one:

    {include_content_item 123 readmore='Your ReadMore Link >>>|Your HideDetails Link >>>' fadein=1 type=button}


Include Content Item module

If you wish to include a content item into a module (as oppose to another content item), use the following module which I've written: Include Content Item Module.

Include a content item into another content item => use this plugin.

Include a content item into another module => use the Include Content Item Module.

Download


How to install (Joomla 1.0.x)

  1. Download the plugin and unzip it into a folder.
  2. From the Installers menu, select mambots. In the field "Install directory", enter the folder location (where you unzipped the file) and click Install.
  3. From the Mambots menu, select Site Mambots.
  4. Make sure the plugin "Include Content Item" is published. If you see a cross in the Published column, just click on it. It will turn into a green tick.
  5. You are now ready to use this plugin!
  6. To include a content item, use the syntax {include_content_item 123}
    where 123 is the ID of the content item to be included.
    (Note: The ID of the respective content item is listed in the Content Items Manager.)

How to install (Joomla 1.5.x)

  1. Download the plugin and unzip it into a folder.
  2. From the Extensions menu, select Install/Uninstall. In the field "Install directory", enter the folder location (where you unzipped the file) and click Install.
  3. From the Extensions menu, select Plugin Manager.
  4. Enable the plugin (Include Content Item) - make sure there is a green tick in the Enabled column.
  5. You are now ready to use this plugin!
  6. To include a content item, use the syntax {include_content_item 123}
    where 123 is the ID of the content item to be included.
    (Note: The ID of the respective content item is listed in the Article Manager.)

Version History

  • version: 1.01/1.51
    released: June 21, 2008
    Main update: now works with PHP4!
  • version: 1.02/1.52
  • Released July 23, 2008

    This is an enhancement contributed by Aleksandar Bogdanovic.

    • Standard use: {include_content_item 123}
    • To add the title of the included article: {include_content_item 123 1}
    • To add the title and link to the included article: {include_content_item 123 1 1}

    Parameter #1: id of the content/article to be included
    Parameter #2: 1 means show title, 0 or ignore means don't show title.
    Parameter #3: 1 means show title and link. 0 or ignore means don't show title and link.

  • version: 1.03/1.53
  • Released July 31, 2008

    This is an enhancement requested by Denis.

    New features:

    • {include_intro 123} will include only the intro of the content item.
    • {include_fulltext 123} will include only the fulltext (or maintext) of the content item.
    • The original {include_content_item 123} will include both the intro and fulltext.

  • v1.0.4 (for Joomla 1.0) and v1.5.4 (for Joomla 1.5)
    Released August 17, 2008
  • This is an enhancement contributed by Dr. J.R.Halon.

    The "Include Content Item" plugin now works with Joom!Fish! (a multilingual content manager for Joomla)

    New features:

    • If you have Joom!Fish installed, the plugin will automatically detect which language the current page is in, and automatically retrieve the corresponding translated page of the specified content item.
    • If there are no translated page for that particular content item, it will use the original content item of the default language.
    • You can "force" the loading of the translated page of a particular language with the following syntax: {include_content_item fr 123}. This will force the page to load the french translation for content item 123.
  • v1.0.5 (for Joomla 1.0) and v1.5.5 (for Joomla 1.5)
    Released December 25, 2008
  • This is an enhancement requested by Rexkramer.

    The "Include Content Item" plugin now allows you to display the "Read More" link.

    Please refer to here for details of how to display the "Read More" link.

  • v1.0.6 (for Joomla 1.0) and v1.5.6 (for Joomla 1.5)
    Released May 5, 2009
  • Yes, the plugin now supports nested include!

    Please refer to here for more details.

  • v1.0.7 (for Joomla 1.0) and v1.5.7 (for Joomla 1.5)
    Released June 14, 2009
  • Added fadein of fulltext

  • v1.0.8 (for Joomla 1.0) and v1.5.8 (for Joomla 1.5)
    Released Jun 30, 2009
    • added fadein/out of fulltext right in the same article (without any reloading of page)
    • If you don't want nested include, use nested=0
    • If you want nested include to stop at level 2, add level=2
    • added support for type=button

  • v1.0.10 (for Joomla 1.0), v1.5.10 (for Joomla 1.5), v1.6.10 (for Joomla 1.6)
    Released July 8, 2011
    • Yes, native version of the plugin for Joomla 1.6 is now available!
    • Updated the plugin to use the latest jquery library: jquery-1.6.2.js
    • In this new version, the article will only be included if it is published. If you unpublish the included article, the article will NOT be displayed.
  • v1.0.11 (for Joomla 1.0), v1.5.11 (for Joomla 1.5), v1.6.11 (for Joomla 1.6), v1.7.11 (for Joomla 1.7)
    Released October 16, 2011
    • Yes, native version of the plugin for Joomla 1.7 is now available!
    • Updated the plugin to use the latest jquery library: jquery-1.6.4.js
    • In this new version, you can now include an article more than once by using the flag $allow_multiple=1. Details here.
  • v1.0.11 (for Joomla 1.0), v1.5.11 (for Joomla 1.5), v1.6.11 (for Joomla 1.6), v1.7.11 (for Joomla 1.7), v2.5.11 (for Joomla 2.5)
    Released January 26, 2012
  • Native version of the plugin for Joomla 2.5 is now available!

FAQ (Frequently Asked Questions)

Q1: I want to include a content item into a module (as oppose to another content item). What should I do?

A1: Use the following module which I've written: Include Content Item Module.