Extensive tutorial on layout overrides

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
sdedhia
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Wed Mar 04, 2009 8:06 pm

Re: Extensive tutorial on layout overrides

Post by sdedhia » Mon Mar 30, 2009 6:31 pm

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

User avatar
masterchief
Joomla! Hero
Joomla! Hero
Posts: 2247
Joined: Fri Aug 12, 2005 2:45 am
Location: Brisbane, Australia
Contact:

Re: Extensive tutorial on layout overrides

Post by masterchief » Mon Mar 30, 2009 11:27 pm

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.
Andrew Eddie - Tweet @AndrewEddie
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.

User avatar
Macsimice
Joomla! Explorer
Joomla! Explorer
Posts: 331
Joined: Sun Mar 18, 2007 12:50 pm
Location: Netherlands
Contact:

Re: Extensive tutorial on layout overrides

Post by Macsimice » Tue Mar 31, 2009 8:08 am

Great Work!
Cheers, Babs
-------------------
http://crossinghippos.com

svivian
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 124
Joined: Wed Feb 27, 2008 4:03 pm
Location: UK
Contact:

Re: Extensive tutorial on layout overrides

Post by svivian » Thu Apr 02, 2009 10:53 am

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.
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.

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

User avatar
masterchief
Joomla! Hero
Joomla! Hero
Posts: 2247
Joined: Fri Aug 12, 2005 2:45 am
Location: Brisbane, Australia
Contact:

Re: Extensive tutorial on layout overrides

Post by masterchief » Thu Apr 02, 2009 12:43 pm

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.

sdedhia
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Wed Mar 04, 2009 8:06 pm

Re: Extensive tutorial on layout overrides

Post by sdedhia » Fri Apr 03, 2009 3:57 pm

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

sdedhia
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Wed Mar 04, 2009 8:06 pm

Re: Extensive tutorial on layout overrides

Post by sdedhia » Fri Apr 03, 2009 4:01 pm

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

cyberpasta
Joomla! Intern
Joomla! Intern
Posts: 81
Joined: Fri Feb 20, 2009 12:30 am

Re: Extensive tutorial on layout overrides

Post by cyberpasta » Tue Apr 14, 2009 11:45 am

Nice tutorial but I think I need to re-read.....or better, I'm goint to print it to study some ot its lines.

tez
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 248
Joined: Tue Nov 14, 2006 3:29 am
Contact:

Re: Extensive tutorial on layout overrides

Post by tez » Sun May 24, 2009 6:21 am

[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.

User avatar
Macsimice
Joomla! Explorer
Joomla! Explorer
Posts: 331
Joined: Sun Mar 18, 2007 12:50 pm
Location: Netherlands
Contact:

Re: Extensive tutorial on layout overrides

Post by Macsimice » Fri Jun 12, 2009 7:06 pm

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).
Often it is little things like Page numbers appearing in Page Titles that most of my clients dont like.
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).
Cheers, Babs
-------------------
http://crossinghippos.com

User avatar
Adesso
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Wed Dec 10, 2008 1:39 pm
Location: Germany
Contact:

Re: Extensive tutorial on layout overrides

Post by Adesso » Fri Jul 03, 2009 10:00 am

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 ???
Whatever you do will return to you, three folded

royaldeveloper
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Jul 10, 2009 7:26 am

Re: Extensive tutorial on layout overrides

Post by royaldeveloper » Fri Jul 10, 2009 7:34 am

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.

daimadaquan
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Fri May 22, 2009 9:04 am

Re: Extensive tutorial on layout overrides

Post by daimadaquan » Sat Jul 11, 2009 2:42 pm

masterchief 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.
It's really good, thanks a lot :)

becyn
Joomla! Explorer
Joomla! Explorer
Posts: 458
Joined: Mon Aug 11, 2008 1:16 am
Location: Newburgh Ny , USA
Contact:

Re: Extensive tutorial on layout overrides

Post by becyn » Sun Jul 12, 2009 3:16 pm

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?
Learn something new every day!

User avatar
dr_lionheart
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 115
Joined: Wed Aug 26, 2009 2:19 am
Location: Jeddah-Saudi Arabia
Contact:

Re: Extensive tutorial on layout overrides

Post by dr_lionheart » Fri Aug 28, 2009 9:32 am

thanks chef
i just started reading it
it is fabulous
PHP designer,
manager,RISEMYWEB
http://www.voxelx.com | Online DICOM viewer and library for radiologists

thewebdoctor
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Jan 24, 2009 3:13 pm

Re: Extensive tutorial on layout overrides

Post by thewebdoctor » Mon Aug 31, 2009 11:43 pm

Thank you.

outsource
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Wed Sep 30, 2009 6:11 pm
Contact:

Re: Extensive tutorial on layout overrides

Post by outsource » Fri Oct 23, 2009 9:53 am

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
You do not have the required permissions to view the files attached to this post.
Best regards
Sreekanth Dayanand
http://www.outsource-online.net

blablaz
Joomla! Intern
Joomla! Intern
Posts: 66
Joined: Tue Sep 01, 2009 12:40 pm

Re: Extensive tutorial on layout overrides

Post by blablaz » Mon Nov 23, 2009 10:51 am

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?

svivian
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 124
Joined: Wed Feb 27, 2008 4:03 pm
Location: UK
Contact:

Re: Extensive tutorial on layout overrides

Post by svivian » Mon Nov 23, 2009 8:43 pm

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?
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.
"Maybe I shouldn't have eaten that packet of powdered gravy I found in the parking lot."
http://www.simpsoncrazy.com

frigidfluid
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Dec 23, 2009 5:50 pm

Re: Extensive tutorial on layout overrides

Post by frigidfluid » Wed Dec 23, 2009 5:53 pm

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?

User avatar
LovE-RicH
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Thu Nov 27, 2008 12:40 pm

Re: Extensive tutorial on layout overrides

Post by LovE-RicH » Tue Feb 09, 2010 12:40 pm

masterchief wrote:It's not really practical to override backend com_content in 1.5 unfortunately.
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?

PS: I need to be able to upgrade to future versions of Joomla.

ThaYoung1!
Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Wed Jan 10, 2007 1:47 pm

Re: Extensive tutorial on layout overrides

Post by ThaYoung1! » Sat Feb 27, 2010 5:09 pm

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)?

ah010223
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Fri May 07, 2010 9:16 am
Location: Dhaka

Re: Extensive tutorial on layout overrides

Post by ah010223 » Mon May 10, 2010 8:31 am

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!
Alan

User avatar
Rusheed
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Mon Aug 02, 2010 1:02 am
Contact:

Re: Extensive tutorial on layout overrides

Post by Rusheed » Wed Aug 04, 2010 3:55 am

nice tutorial for me. great work gratz

grammyuthapa
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Aug 23, 2010 9:16 am

Re: Extensive tutorial on layout overrides

Post by grammyuthapa » Mon Aug 23, 2010 10:05 am

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

Milbo
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Fri Aug 08, 2008 7:33 am

Re: Extensive tutorial on layout overrides

Post by Milbo » Thu Oct 14, 2010 10:59 am

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

Code: Select all

$mainframe = JFactory::getApplication();
$mainframe->set('setTemplate', $template);
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)

kristen404
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Oct 18, 2010 12:05 am

Re: Extensive tutorial on layout overrides

Post by kristen404 » Mon Oct 18, 2010 12:54 pm

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/

irosas
Joomla! Apprentice
Joomla! Apprentice
Posts: 39
Joined: Mon Nov 01, 2010 5:42 pm

Re: Extensive tutorial on layout overrides

Post by irosas » Wed Nov 03, 2010 2:44 pm

It appears your extensive tutorial on layout overrides has been moved. Can you give us a new link? Thanks!

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44018
Joined: Sat Apr 05, 2008 9:58 pm

Re: Extensive tutorial on layout overrides

Post by Webdongle » Wed Nov 03, 2010 3:30 pm

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".

User avatar
Nick Savov
Joomla! Ace
Joomla! Ace
Posts: 1076
Joined: Tue Apr 13, 2010 7:40 pm

Re: Extensive tutorial on layout overrides

Post by Nick Savov » Thu May 26, 2011 8:55 pm

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!
Joomla Templates created by the Wright Framework.

"God is most glorified in us, when we are most satisfied in Him" - http://www.desiringgod.org/


Locked

Return to “Joomla! 1.5 Coding”