Page 2 of 2

Re: Extensive tutorial on layout overrides

Posted: Mon Mar 30, 2009 6:31 pm
by sdedhia
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

Re: Extensive tutorial on layout overrides

Posted: Mon Mar 30, 2009 11:27 pm
by masterchief
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.

Re: Extensive tutorial on layout overrides

Posted: Tue Mar 31, 2009 8:08 am
by Macsimice
Great Work!

Re: Extensive tutorial on layout overrides

Posted: Thu Apr 02, 2009 10:53 am
by svivian
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?

Re: Extensive tutorial on layout overrides

Posted: Thu Apr 02, 2009 12:43 pm
by masterchief
If you are wanting to go that far, you are probably better off copying the whole search component and making changes.

Re: Extensive tutorial on layout overrides

Posted: Fri Apr 03, 2009 3:57 pm
by sdedhia
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

Re: Extensive tutorial on layout overrides

Posted: Fri Apr 03, 2009 4:01 pm
by sdedhia
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

Re: Extensive tutorial on layout overrides

Posted: Tue Apr 14, 2009 11:45 am
by cyberpasta
Nice tutorial but I think I need to re-read.....or better, I'm goint to print it to study some ot its lines.

Re: Extensive tutorial on layout overrides

Posted: Sun May 24, 2009 6:21 am
by tez
[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.

Re: Extensive tutorial on layout overrides

Posted: Fri Jun 12, 2009 7:06 pm
by Macsimice
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).

Re: Extensive tutorial on layout overrides

Posted: Fri Jul 03, 2009 10:00 am
by Adesso
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 ???

Re: Extensive tutorial on layout overrides

Posted: Fri Jul 10, 2009 7:34 am
by royaldeveloper
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.

Re: Extensive tutorial on layout overrides

Posted: Sat Jul 11, 2009 2:42 pm
by daimadaquan
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 :)

Re: Extensive tutorial on layout overrides

Posted: Sun Jul 12, 2009 3:16 pm
by becyn
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?

Re: Extensive tutorial on layout overrides

Posted: Fri Aug 28, 2009 9:32 am
by dr_lionheart
thanks chef
i just started reading it
it is fabulous

Re: Extensive tutorial on layout overrides

Posted: Mon Aug 31, 2009 11:43 pm
by thewebdoctor
Thank you.

Re: Extensive tutorial on layout overrides

Posted: Fri Oct 23, 2009 9:53 am
by outsource
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

Re: Extensive tutorial on layout overrides

Posted: Mon Nov 23, 2009 10:51 am
by blablaz
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?

Re: Extensive tutorial on layout overrides

Posted: Mon Nov 23, 2009 8:43 pm
by svivian
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.

Re: Extensive tutorial on layout overrides

Posted: Wed Dec 23, 2009 5:53 pm
by frigidfluid
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?

Re: Extensive tutorial on layout overrides

Posted: Tue Feb 09, 2010 12:40 pm
by LovE-RicH
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.

Re: Extensive tutorial on layout overrides

Posted: Sat Feb 27, 2010 5:09 pm
by ThaYoung1!
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)?

Re: Extensive tutorial on layout overrides

Posted: Mon May 10, 2010 8:31 am
by ah010223
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!

Re: Extensive tutorial on layout overrides

Posted: Wed Aug 04, 2010 3:55 am
by Rusheed
nice tutorial for me. great work gratz

Re: Extensive tutorial on layout overrides

Posted: Mon Aug 23, 2010 10:05 am
by grammyuthapa
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.

Re: Extensive tutorial on layout overrides

Posted: Thu Oct 14, 2010 10:59 am
by Milbo
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)

Re: Extensive tutorial on layout overrides

Posted: Mon Oct 18, 2010 12:54 pm
by kristen404
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!

Re: Extensive tutorial on layout overrides

Posted: Wed Nov 03, 2010 2:44 pm
by irosas
It appears your extensive tutorial on layout overrides has been moved. Can you give us a new link? Thanks!

Re: Extensive tutorial on layout overrides

Posted: Wed Nov 03, 2010 3:30 pm
by Webdongle

Re: Extensive tutorial on layout overrides

Posted: Thu May 26, 2011 8:55 pm
by Nick Savov
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!