Extensive tutorial on layout overrides
-
- Joomla! Apprentice
- Posts: 20
- Joined: Wed Mar 04, 2009 8:06 pm
Re: Extensive tutorial on layout overrides
Thank you for the tutorial. After reading it, I have some questions.
I am using the beez template and want to turn of the date created text in the search results. I was able to remove that text by editing components/com_search/views/views/search/view.html.php.
How can I override that view? I tried by copying view.html.php in the templates/beez/html/com_search/search folder. However, it does not work.
Can you clarify my doubt.
Thanks,
Sonal
I am using the beez template and want to turn of the date created text in the search results. I was able to remove that text by editing components/com_search/views/views/search/view.html.php.
How can I override that view? I tried by copying view.html.php in the templates/beez/html/com_search/search folder. However, it does not work.
Can you clarify my doubt.
Thanks,
Sonal
- masterchief
- Joomla! Hero
- Posts: 2247
- Joined: Fri Aug 12, 2005 2:45 am
- Location: Brisbane, Australia
- Contact:
Re: Extensive tutorial on layout overrides
You want to copy /components/com_search/views/search/tmpl/default* to /html/com_search/search/default*
Don't copy the view.html.php file - that won't work.
Don't copy the view.html.php file - that won't work.
Andrew Eddie - Tweet @AndrewEddie
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.
- Macsimice
- Joomla! Explorer
- Posts: 331
- Joined: Sun Mar 18, 2007 12:50 pm
- Location: Netherlands
- Contact:
Re: Extensive tutorial on layout overrides
Great Work!
-
- Joomla! Enthusiast
- Posts: 124
- Joined: Wed Feb 27, 2008 4:03 pm
- Location: UK
- Contact:
Re: Extensive tutorial on layout overrides
Is it possible to override the view.html.php in any way? I'm sure I read that you can override any models, views, etc.masterchief wrote:You want to copy /components/com_search/views/search/tmpl/default* to /html/com_search/search/default*
Don't copy the view.html.php file - that won't work.
I've modified the way the weblinks submission component works (removed the need to have an account). However I'd prefer to use an override, so changes don't get reverted when Joomla gets updated. Is this possible?
"Maybe I shouldn't have eaten that packet of powdered gravy I found in the parking lot."
http://www.simpsoncrazy.com
http://www.simpsoncrazy.com
- masterchief
- Joomla! Hero
- Posts: 2247
- Joined: Fri Aug 12, 2005 2:45 am
- Location: Brisbane, Australia
- Contact:
Re: Extensive tutorial on layout overrides
If you are wanting to go that far, you are probably better off copying the whole search component and making changes.
Andrew Eddie - Tweet @AndrewEddie
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.
-
- Joomla! Apprentice
- Posts: 20
- Joined: Wed Mar 04, 2009 8:06 pm
Re: Extensive tutorial on layout overrides
masterchief wrote:You want to copy /components/com_search/views/search/tmpl/default* to /html/com_search/search/default*
Don't copy the view.html.php file - that won't work.
Got it! Thank you for your help.
Sonal
-
- Joomla! Apprentice
- Posts: 20
- Joined: Wed Mar 04, 2009 8:06 pm
Re: Extensive tutorial on layout overrides
Please confirm if my understanding is correct for the following edits I need to make.
*) I was able to remove the 'data created' text in the search results. I need to replace it with another date. This should be a plugin, correct?
*) I want the search areas to be changed from Category, Section, Article to specific categories for the website I am updating(eg. Books, References, etc). For that I will need to write a plugin and edit the SQL query, correct?
Thank you for your help.
Sonal
*) I was able to remove the 'data created' text in the search results. I need to replace it with another date. This should be a plugin, correct?
*) I want the search areas to be changed from Category, Section, Article to specific categories for the website I am updating(eg. Books, References, etc). For that I will need to write a plugin and edit the SQL query, correct?
Thank you for your help.
Sonal
-
- Joomla! Intern
- Posts: 81
- Joined: Fri Feb 20, 2009 12:30 am
Re: Extensive tutorial on layout overrides
Nice tutorial but I think I need to re-read.....or better, I'm goint to print it to study some ot its lines.
-
- Joomla! Enthusiast
- Posts: 248
- Joined: Tue Nov 14, 2006 3:29 am
- Contact:
Re: Extensive tutorial on layout overrides
[quote="svivian"]Is it possible to override the view.html.php in any way? I'm sure I read that you can override any models, views, etc.[/quote]
I'd like to know about this too, there are many times I just want to tweak a few design elements without making my own complete component. Often it is little things like Page numbers appearing in Page Titles that most of my clients dont like.
I'd like to know about this too, there are many times I just want to tweak a few design elements without making my own complete component. Often it is little things like Page numbers appearing in Page Titles that most of my clients dont like.
- Macsimice
- Joomla! Explorer
- Posts: 331
- Joined: Sun Mar 18, 2007 12:50 pm
- Location: Netherlands
- Contact:
Re: Extensive tutorial on layout overrides
You do depend on the variables that the view.html.php sends to the layout (or that the layout grabs from the view.html.php, if you prefer). But you can perform additional tasks in your layout page (like getting stuff from the database or re-formatting content).
That's actually coming from a content plugin (pagebreak.php). You cannot alter this (well, you can, but you shouldn't). You could however duplicate this plugin, rename it and use it instead of the original. Than tweak it in anyway you like (this plugin also renders the table of content in multi-page articles).Often it is little things like Page numbers appearing in Page Titles that most of my clients dont like.
- Adesso
- Joomla! Enthusiast
- Posts: 104
- Joined: Wed Dec 10, 2008 1:39 pm
- Location: Germany
- Contact:
Re: Extensive tutorial on layout overrides
Greetings,
I also have a bit of a problem, and with the good old com_search, now basically all I want is a raw view for Ajax, but the standard search has none, and if I override the normal view... well we all know what happens then..You kill your normal search
So Something that would be nice in future version, is to be able to add/extend, and not just override. This way one can add views to existing components, without really touching them.
Maybe this is already possible
I also have a bit of a problem, and with the good old com_search, now basically all I want is a raw view for Ajax, but the standard search has none, and if I override the normal view... well we all know what happens then..You kill your normal search
So Something that would be nice in future version, is to be able to add/extend, and not just override. This way one can add views to existing components, without really touching them.
Maybe this is already possible
Whatever you do will return to you, three folded
-
- Joomla! Fledgling
- Posts: 1
- Joined: Fri Jul 10, 2009 7:26 am
Re: Extensive tutorial on layout overrides
I m new to joomla can you help for getting data into tabular format and with pagination. actually i dont know what I have to do for this.
-
- Joomla! Apprentice
- Posts: 20
- Joined: Fri May 22, 2009 9:04 am
Re: Extensive tutorial on layout overrides
It's really good, thanks a lotmasterchief wrote:I've done an extensive tutorial on layout overrides (and a few other things) on the developer site:
http://developer.joomla.org/tutorials/3 ... oomla.html
Hope people find it useful and if there is anything missing or anything is unclear let me know.
-
- Joomla! Explorer
- Posts: 458
- Joined: Mon Aug 11, 2008 1:16 am
- Location: Newburgh Ny , USA
- Contact:
Re: Extensive tutorial on layout overrides
I tried experimenting with this on a localhost site with RUK_Milkyway.
I'm not sure what that "sliders" chrome does, but I went with implementing it
on the mod_login, since i wanted to enhance that one anyway, just to see what would happen.
I copied the mod-login recursively into the template html directory, I placed the xtml tag in the form
and set name to 'login".
Nothing happened at all. Is this because it is not MVC?
I'm not sure what that "sliders" chrome does, but I went with implementing it
on the mod_login, since i wanted to enhance that one anyway, just to see what would happen.
I copied the mod-login recursively into the template html directory, I placed the xtml tag in the form
and set name to 'login".
Nothing happened at all. Is this because it is not MVC?
Learn something new every day!
- dr_lionheart
- Joomla! Enthusiast
- Posts: 115
- Joined: Wed Aug 26, 2009 2:19 am
- Location: Jeddah-Saudi Arabia
- Contact:
Re: Extensive tutorial on layout overrides
thanks chef
i just started reading it
it is fabulous
i just started reading it
it is fabulous
PHP designer,
manager,RISEMYWEB
http://www.voxelx.com | Online DICOM viewer and library for radiologists
manager,RISEMYWEB
http://www.voxelx.com | Online DICOM viewer and library for radiologists
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat Jan 24, 2009 3:13 pm
Re: Extensive tutorial on layout overrides
Thank you.
-
- Joomla! Apprentice
- Posts: 46
- Joined: Wed Sep 30, 2009 6:11 pm
- Contact:
Re: Extensive tutorial on layout overrides
In my template I wanted to show modules ina postion one after another in the same row.I tried <jdoc:include type="modules" name="user1" style="horz"/> but it didnt give me the result i needed.I replaced it with <jdoc:include type="modules" name="user1" style="horizontal"/>
and edited 'templates/mytemplate/html/modules.php' and added function modChrome_horizontal($module, &$params, &$attribs) like this
unction modChrome_horizontal($module, &$params, &$attribs)
{
$curtemplate = JDocumentHTML::getInstance();
if($GLOBALS[$attribs['name']."_pos"]+0 == 0)
{
?>
<table align="center" width="100%">
<tr>
<?php
}
?>
<td valign="top">
<?php
modChrome_table($module, $params, $attribs); ?>
</td>
<?php
$GLOBALS[$attribs['name']."_pos"]++;
if($curtemplate->countModules($attribs['name']) == $GLOBALS[$attribs['name']."_pos"])
{
?>
</tr>
</table>
<?php
}
}
If there is a better way than this please let me know
and edited 'templates/mytemplate/html/modules.php' and added function modChrome_horizontal($module, &$params, &$attribs) like this
unction modChrome_horizontal($module, &$params, &$attribs)
{
$curtemplate = JDocumentHTML::getInstance();
if($GLOBALS[$attribs['name']."_pos"]+0 == 0)
{
?>
<table align="center" width="100%">
<tr>
<?php
}
?>
<td valign="top">
<?php
modChrome_table($module, $params, $attribs); ?>
</td>
<?php
$GLOBALS[$attribs['name']."_pos"]++;
if($curtemplate->countModules($attribs['name']) == $GLOBALS[$attribs['name']."_pos"])
{
?>
</tr>
</table>
<?php
}
}
If there is a better way than this please let me know
You do not have the required permissions to view the files attached to this post.
-
- Joomla! Intern
- Posts: 66
- Joined: Tue Sep 01, 2009 12:40 pm
Re: Extensive tutorial on layout overrides
Hello everyone,
I need to override the com_registration, I need to add another field ( 2 radio buttons for the user to select one option or the other.. ).
I have been looking around for tips and stuff, but I cant really find the file that generates the page.
Any help?
I need to override the com_registration, I need to add another field ( 2 radio buttons for the user to select one option or the other.. ).
I have been looking around for tips and stuff, but I cant really find the file that generates the page.
Any help?
-
- Joomla! Enthusiast
- Posts: 124
- Joined: Wed Feb 27, 2008 4:03 pm
- Location: UK
- Contact:
Re: Extensive tutorial on layout overrides
That's not what layout overrides are for. They're only for changing the output of what's already there. You'll have to either find a dedicated user component, or maybe read this tutorial and see if that helps you with where to edit code.blablaz wrote:Hello everyone,
I need to override the com_registration, I need to add another field ( 2 radio buttons for the user to select one option or the other.. ).
I have been looking around for tips and stuff, but I cant really find the file that generates the page.
Any help?
"Maybe I shouldn't have eaten that packet of powdered gravy I found in the parking lot."
http://www.simpsoncrazy.com
http://www.simpsoncrazy.com
-
- Joomla! Fledgling
- Posts: 1
- Joined: Wed Dec 23, 2009 5:50 pm
Re: Extensive tutorial on layout overrides
I created an override for article/form.php which work fine for normal article submissions, but I've also got a link for "special" users to submit content to a specific category. The link type in the usermenu is ContentSubmit » Article / Bysection This does not seem to be applying the override created for article/form.php. Does anyone know where/how to make an override for this type?
- LovE-RicH
- Joomla! Apprentice
- Posts: 17
- Joined: Thu Nov 27, 2008 12:40 pm
Re: Extensive tutorial on layout overrides
Any news on this? Maybe it's better in Joomla 1.6? If yes, can I uninstall com_content from 1.5 and install just the com_content 1.6 component to start working on my custom admin/com_content?masterchief wrote:It's not really practical to override backend com_content in 1.5 unfortunately.
PS: I need to be able to upgrade to future versions of Joomla.
-
- Joomla! Apprentice
- Posts: 48
- Joined: Wed Jan 10, 2007 1:47 pm
Re: Extensive tutorial on layout overrides
I'd like to customize the admin/com_content just like some others in this thread. I would like to add a separate image to each article. This image has to be next to the article on a blog layout (which consists out of 6 rows with 2 columns). On the left column the image has to be at the right. On the right column the image has to be at the left.
Putting the image in the content of the article is not user friendly for my end-user. I see that overrides don't work for the admin/com_content component in the administrator backend.
So this leaves one option as I see it now: customize the administrator component / database. A disadvantage is that in case of updates I really have to doublecheck the contents of the update so my changes aren't undone.
Is this the best strategy or are there other options for me (and others)?
Putting the image in the content of the article is not user friendly for my end-user. I see that overrides don't work for the admin/com_content component in the administrator backend.
So this leaves one option as I see it now: customize the administrator component / database. A disadvantage is that in case of updates I really have to doublecheck the contents of the update so my changes aren't undone.
Is this the best strategy or are there other options for me (and others)?
-
- Joomla! Apprentice
- Posts: 31
- Joined: Fri May 07, 2010 9:16 am
- Location: Dhaka
Re: Extensive tutorial on layout overrides
It is ok that we should not override joomla backend com_content. But some times we are in such a situation that we have to change or override some part of any backend component. I am notable to show you guys a specific example but situation demands.
So I think plugin is the best solution.
Cheers!
So I think plugin is the best solution.
Cheers!
Alan
- Rusheed
- Joomla! Apprentice
- Posts: 35
- Joined: Mon Aug 02, 2010 1:02 am
- Contact:
Re: Extensive tutorial on layout overrides
nice tutorial for me. great work gratz
-
- Joomla! Fledgling
- Posts: 3
- Joined: Mon Aug 23, 2010 9:16 am
Re: Extensive tutorial on layout overrides
I have looked at the folder structure and is a model and view the folder, but not in the drivers folder. So this is a MVC form.
Please read forum rules regarding signatures: http://forum.joomla.org/viewtopic.php?t=65
-
- Joomla! Apprentice
- Posts: 47
- Joined: Fri Aug 08, 2008 7:33 am
Re: Extensive tutorial on layout overrides
I am sorry I get an "Article not found" using the link. So maybe I am asking here something which is described in the article.
I understood the common override and how to use it as templater, but I am developing a component with own categories (we have nested ones) and "articles".
It will be often needed that users want to use a default joomla template and just want to change the template by article or category.
It is possible to load multiple css and js, so we had the idea that it would be nice, when we could load 2 templates in one time.
My question is just how I can override the used template in the code? So that my view.html.php is looking itself which template should be used and can set it somehow. Or maybe just loads two templates. One for the general joomla and one just for the com_xyz folder.
Hmm maybe I try to explain it other round. I want to add to the categories the possibility to edit the used templates. I want to add two configuration fields, one with the general joomla template and one complemental with defining the extra doms used by the component.
We already thought about to add every of our categories to the joomla ones and just add an extra edit possibility to the category edit view. Afaik J1.6 will support nested categories also, so maybe we should use the joomla ones.
I dont know. At the end I am just looking how I can set my own template in the view.html.php
Greetz Milbo
BTW: I think the right link is now http://docs.joomla.org/Understanding_Output_Overrides
PS: YEah, I found the simpel solution I was looking for, $template is just something like beez
Now I have only the question, how I can do an override of the override (loading two templates in one time, sounds strange in fact this is already done (template set overrides the default),.. so I look for a way to load three templates at once)
I understood the common override and how to use it as templater, but I am developing a component with own categories (we have nested ones) and "articles".
It will be often needed that users want to use a default joomla template and just want to change the template by article or category.
It is possible to load multiple css and js, so we had the idea that it would be nice, when we could load 2 templates in one time.
My question is just how I can override the used template in the code? So that my view.html.php is looking itself which template should be used and can set it somehow. Or maybe just loads two templates. One for the general joomla and one just for the com_xyz folder.
Hmm maybe I try to explain it other round. I want to add to the categories the possibility to edit the used templates. I want to add two configuration fields, one with the general joomla template and one complemental with defining the extra doms used by the component.
We already thought about to add every of our categories to the joomla ones and just add an extra edit possibility to the category edit view. Afaik J1.6 will support nested categories also, so maybe we should use the joomla ones.
I dont know. At the end I am just looking how I can set my own template in the view.html.php
Greetz Milbo
BTW: I think the right link is now http://docs.joomla.org/Understanding_Output_Overrides
PS: YEah, I found the simpel solution I was looking for, $template is just something like beez
Code: Select all
$mainframe = JFactory::getApplication();
$mainframe->set('setTemplate', $template);
-
- Joomla! Fledgling
- Posts: 3
- Joined: Mon Oct 18, 2010 12:05 am
Re: Extensive tutorial on layout overrides
Wow, this quite a nice tutorial, but for me it's information overload very quick, so I think a good idea is to print all of this, but it's very much just what I needed to learn, thanks!
Webmaster - Joomla Novice - http://www.bestenettbutikker.no/
-
- Joomla! Apprentice
- Posts: 39
- Joined: Mon Nov 01, 2010 5:42 pm
Re: Extensive tutorial on layout overrides
It appears your extensive tutorial on layout overrides has been moved. Can you give us a new link? Thanks!
- Webdongle
- Joomla! Master
- Posts: 44129
- Joined: Sat Apr 05, 2008 9:58 pm
Re: Extensive tutorial on layout overrides
If it moves again then
http://www.google.co.uk/search?num=100& ... =&gs_rfai=
will most likely find it.
Or
http://docs.joomla.org/Special:Search?s ... ext=Search
http://www.google.co.uk/search?num=100& ... =&gs_rfai=
will most likely find it.
Or
http://docs.joomla.org/Special:Search?s ... ext=Search
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
- Nick Savov
- Joomla! Ace
- Posts: 1076
- Joined: Tue Apr 13, 2010 7:40 pm
Re: Extensive tutorial on layout overrides
This is the new location of the doc (I think it's the same one):
http://docs.joomla.org/Understanding_Output_Overrides
Also, here's another reference:
http://docs.joomla.org/How_to_override_ ... omla!_core
Kind regards,
Nick
p.s. Great work Andrew!
http://docs.joomla.org/Understanding_Output_Overrides
Also, here's another reference:
http://docs.joomla.org/How_to_override_ ... omla!_core
Kind regards,
Nick
p.s. Great work Andrew!
Joomla Templates created by the Wright Framework.
"God is most glorified in us, when we are most satisfied in Him" - http://www.desiringgod.org/
"God is most glorified in us, when we are most satisfied in Him" - http://www.desiringgod.org/