Advertisement
Template for article
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
-
- Joomla! Apprentice
- Posts: 21
- Joined: Wed Nov 15, 2017 3:50 pm
Template for article
Hi
I need to make an article template that will be used for many (+100 pages)
The article should show the info I enter when I create the article. I have created some custom fields like the below under "create article":
Location:
Fish type:
Food:
Size:
Famely:
That will be a part of the article page.
How ever the page will be with a photo in the left side and the fact info from above in the right side of the page.
Question is:
Do I need to code the article page for each article I create or is it possible some how to create a template that I can link to from the menu and then the article is using the template I wish to use - Just as now in the menu when I choose an article to link to.
Or is there an otherway to do this?
its difficult to explain but hope you understand what I mean
Thanks
/Gert
I need to make an article template that will be used for many (+100 pages)
The article should show the info I enter when I create the article. I have created some custom fields like the below under "create article":
Location:
Fish type:
Food:
Size:
Famely:
That will be a part of the article page.
How ever the page will be with a photo in the left side and the fact info from above in the right side of the page.
Question is:
Do I need to code the article page for each article I create or is it possible some how to create a template that I can link to from the menu and then the article is using the template I wish to use - Just as now in the menu when I choose an article to link to.
Or is there an otherway to do this?
its difficult to explain but hope you understand what I mean
Thanks
/Gert
Advertisement
-
- Joomla! Champion
- Posts: 6460
- Joined: Tue Aug 23, 2005 1:56 pm
- Location: South coast, UK
- Contact:
Re: Template for article
Brian Teeman shows how to make article templates in tinymce in one of the magazine articles, you will have to search through to find it.
https://gadsolutions.biz Electrical services
https://electrical-testing-safety.co.uk Testing services
https://electrical-testing-safety.co.uk Testing services
-
- Joomla! Apprentice
- Posts: 21
- Joined: Wed Nov 15, 2017 3:50 pm
Re: Template for article
Thx, I found the article here:
https://magazine.joomla.org/all-issues/ ... lready-had
Anyway I need template to place the info from my custom fields
(I have created under Content and Fields:
Location:
Fish type:
Food:
Size:
Famely:)
where I want it to be displayed in a table.
Right now I just show op in the top of a created article. Is that possible to move it to for an example in a table, by addning a code to the template where I want it to show up?
https://magazine.joomla.org/all-issues/ ... lready-had
Anyway I need template to place the info from my custom fields
(I have created under Content and Fields:
Location:
Fish type:
Food:
Size:
Famely:)
where I want it to be displayed in a table.
Right now I just show op in the top of a created article. Is that possible to move it to for an example in a table, by addning a code to the template where I want it to show up?
- toivo
- Joomla! Master
- Posts: 17925
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: Template for article
If you want to change the way how the custom fields are presented in the article layout, create a template override and modify the PHP code for the article view: Template Overrides
Brian Teeman has also developed a method to create installable Joomla child templates that contain template overrides, which looks interesting: Template Overrides - Recycle and reuse
Brian Teeman has also developed a method to create installable Joomla child templates that contain template overrides, which looks interesting: Template Overrides - Recycle and reuse
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 21
- Joined: Wed Nov 15, 2017 3:50 pm
Re: Template for article
I see - Thanks. I have tried to figure out what file to make a copy of and start changing the codes in, to make a new predefined layout. What I have done:toivo wrote: ↑Tue Oct 29, 2024 9:13 pm If you want to change the way how the custom fields are presented in the article layout, create a template override and modify the PHP code for the article view: Template Overrides
Brian Teeman has also developed a method to create installable Joomla child templates that contain template overrides, which looks interesting: Template Overrides - Recycle and reuse
1: in Templates: Customise (Cassiopeia) I have tried to create an override of the original default article page. I have made an override of the below files and add some codes:
Components -> com_content -> article
Modules -> mod_articles
2: when i choose an article (already made) and go to the tab Options and choose the new Layout I just have made, save it, I cant see the changes I made in the files above.
So my question is, im I changing the codes in the wrong file or what im I doing wrong?
- toivo
- Joomla! Master
- Posts: 17925
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: Template for article
If you follow the tutorial Template Overrides, the article view that can be modified is the file templates/cassiopeia/html/com_content/article/default.php.
If you want to modify the module Articles, the override file is stored as templates/cassiopeia/html/mod_articles/default.php but the override also includes the file default_items.php and default_titles.php.
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 21
- Joined: Wed Nov 15, 2017 3:50 pm
Re: Template for article
Thanks. I have tried to make an override file called TEST-TEMPLATE.php. Its placed here:
templates/cassiopeia/html/com_content/article/TEST-TEMPLATE.php
Now if I open an article, go to the tab "Options" and change the layout from "Use Global" to TEST-TEMPLATE it does not change anything on the article page on my website.
Do I understand this wrong? I understood that I could make serval layout for articles and then choose what layout under the tab "Options" I wanted to use on an given article?
BTW if I make a test template and upload it under:
templates/cassiopeia/html/mod_articles/
Im not able to choose anywhere that I want to use that for a given article.
Hope it make sense what I mean
templates/cassiopeia/html/com_content/article/TEST-TEMPLATE.php
Now if I open an article, go to the tab "Options" and change the layout from "Use Global" to TEST-TEMPLATE it does not change anything on the article page on my website.
Do I understand this wrong? I understood that I could make serval layout for articles and then choose what layout under the tab "Options" I wanted to use on an given article?
BTW if I make a test template and upload it under:
templates/cassiopeia/html/mod_articles/
Im not able to choose anywhere that I want to use that for a given article.
Hope it make sense what I mean
-
- Joomla! Champion
- Posts: 6460
- Joined: Tue Aug 23, 2005 1:56 pm
- Location: South coast, UK
- Contact:
Re: Template for article
I believe your override file names have to be the same as the file you are overriding.
https://gadsolutions.biz Electrical services
https://electrical-testing-safety.co.uk Testing services
https://electrical-testing-safety.co.uk Testing services
-
- Joomla! Guru
- Posts: 588
- Joined: Fri Dec 02, 2005 10:46 am
- Location: The Netherlands
Re: Template for article
Yes and no.
When you use default.php the override will apply to all default article pages.
When you want specific articles from a blog or list to have an override, you need to give it a different name.
Give the file a simple name. I.e. food.php, fish.php, whateveryouliketonameit.php
You cannot use special characters, so no dashes, underscores*, etc. in the name.
* underscores have a specific use in overrides.
You then select this override in your category blog/list menu item, under Options: Choose a layout.
All articles linked from this menu item will use the override.
When you use default.php the override will apply to all default article pages.
When you want specific articles from a blog or list to have an override, you need to give it a different name.
Give the file a simple name. I.e. food.php, fish.php, whateveryouliketonameit.php
You cannot use special characters, so no dashes, underscores*, etc. in the name.
* underscores have a specific use in overrides.
You then select this override in your category blog/list menu item, under Options: Choose a layout.
All articles linked from this menu item will use the override.
-
- Joomla! Apprentice
- Posts: 21
- Joined: Wed Nov 15, 2017 3:50 pm
Re: Template for article
Thanks for the reply.
Can you guide me a little through this:
1. I create a new new layout file called fish.php. The file will have my PHP changes I have made.
2. I upload the file to the folder /templates/cassiopeia/html/com_content/article/ (is this correct?)
3. I create a new article called Fishart.
4. In the article Fishart, I choose the tab "Options" and change the layout from "Use Global" to "fish" (is this correct?)
What do I do next? When I do the above, the article Fishart is still use the "Default" layout.
I really can't figure this out, I hope you can advice - THANKS.
Can you guide me a little through this:
1. I create a new new layout file called fish.php. The file will have my PHP changes I have made.
2. I upload the file to the folder /templates/cassiopeia/html/com_content/article/ (is this correct?)
3. I create a new article called Fishart.
4. In the article Fishart, I choose the tab "Options" and change the layout from "Use Global" to "fish" (is this correct?)
What do I do next? When I do the above, the article Fishart is still use the "Default" layout.
I really can't figure this out, I hope you can advice - THANKS.
-
- Joomla! Guru
- Posts: 588
- Joined: Fri Dec 02, 2005 10:46 am
- Location: The Netherlands
Re: Template for article
Almost...
4. The layout for articles is set in the menu-item.
Open or create a/the menu-item that displays the articles in a category blog or list.
Under tab: Options you'll find Choose a layout.
Select Fish.
4. The layout for articles is set in the menu-item.
Open or create a/the menu-item that displays the articles in a category blog or list.
Under tab: Options you'll find Choose a layout.
Select Fish.
-
- Joomla! Apprentice
- Posts: 21
- Joined: Wed Nov 15, 2017 3:50 pm
Re: Template for article
Its working - Perfect Thanks.
Would it be possible to to link the menu direct to the article without linking to the blog or list? Means choose "Single Article" in menu item type.
Would it be possible to to link the menu direct to the article without linking to the blog or list? Means choose "Single Article" in menu item type.
-
- Joomla! Guru
- Posts: 588
- Joined: Fri Dec 02, 2005 10:46 am
- Location: The Netherlands
Re: Template for article
Yes, you can.
For this you also need an xml file with the same name.
I.e. food.php and food.xml
Just copy and rename ~/components/com_content/tmpl/article/default.xml to ~/templates/your-template/html/com_content/article/food.xml
Then open this file to edit thisto i.e.
Or if you have a multilingual backend you can replace the DEFAULT_LANGUAGE_CONSTANTS with YOUR_OWN_LANGUAGE_CONSTANTS...
For this you also need an xml file with the same name.
I.e. food.php and food.xml
Just copy and rename ~/components/com_content/tmpl/article/default.xml to ~/templates/your-template/html/com_content/article/food.xml
Then open this file to edit this
Code: Select all
<layout title="COM_CONTENT_ARTICLE_VIEW_DEFAULT_TITLE" option="COM_CONTENT_ARTICLE_VIEW_DEFAULT_OPTION">
<help
key = "Menu_Item:_Single_Article"
/>
<message>
<![CDATA[COM_CONTENT_ARTICLE_VIEW_DEFAULT_DESC]]>
</message>
</layout>
Code: Select all
<layout title="Single Food Article" option="foodarticle">
<help
key = "Menu_Item:_Single_Article"
/>
<message>
Display a single selected food article
</message>
</layout>
Advertisement