[ext:joomla] How to display content from a specific article ID #746
-
How do we go about displaying information from a specific article ID? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hello Matthew, Displaying content from a single Joomla article is very easy in Pages using the Joomla extension. Here are the steps (for 0.21): Install Joomla extensionInstalling the Joomla extension is really simple, just download http://files.joomlatools.com/[email protected]/extension-joomla.zip and put it in Getting an article by id or aliasThe Joomla extension provides a custom For example to retrieve the article with id = 1<article>
<h1><?= article(1)->title ?></h1>
<p><?= article(1)->excerpt.article(1)->text ?></p>
</article> To get an idea of all the different properties you can do <?= var_dump(article(1)); ?>
More info about properties and naming conventions see below. For example to retrieve the article with alias = 'my-article'<article>
<h1><?= article('my-article')->title ?></h1>
<p><?= article('my-article')->excerpt.article('my-article')->text ?></p>
</article> Defining custom aliasesUsing Joomla article aliases directly could results into articles not being found it the alias is edited (by accident). To resolve that and to still make it possible to reference an article by a string you can define your own custom static aliases through the configuration For example define an alias called
|
Beta Was this translation helpful? Give feedback.
Hello Matthew,
Displaying content from a single Joomla article is very easy in Pages using the Joomla extension. Here are the steps (for 0.21):
Install Joomla extension
Installing the Joomla extension is really simple, just download http://files.joomlatools.com/[email protected]/extension-joomla.zip and put it in
/joomlatools-pages/extensions
directory.Getting an article by id or alias
The Joomla extension provides a custom
article()
template function that allows to get a single article by it'sid
oralias
.For example to retrieve the article with id = 1
To get an idea of all the d…