3

I am working in Joomla 1.5 and have developed a component, that component have 2 view having same part in both views. I am repeating code, as I have used same code in 2 different views. So I want to know that is there some way that I write it once and use in both views and can remove repetitions? Is there some thing like standalone view or partial e.t.c in Joomla? That part have show some data that come from db. So view render a template by sending it some data from DB.

I hope my question is quite clear. I am not sure that module is some thing that I should use here. I am a good developer but don't know every thing so please some quick and better way.

thanks in advance to all developers.

Hafiz
  • 4,187
  • 12
  • 58
  • 111
  • This is similar to http://stackoverflow.com/a/9071171/52834 I answered for Joomla! 1.7 - there are only a few differences for Joomla! 1.5.x ie. you replace the JInput with the older JRequest calls. – Craig Mar 02 '12 at 23:48

1 Answers1

-1

Not sure what you want to do. In Joomla a view has the following file structure: Inside the view folder there is viewname/view.html.php file which is used to get the data from the model. Inside the same folder there is another folder called viewname/tmpl/. You can add your layout files in there which can have different html code but get the same data from view.html.php(which gets it from the model).

samaras
  • 235
  • 4
  • 20
  • I don't know what did you answered. I already know this all, but I am asking a different thing, please first read the question carefully. – Hafiz May 09 '12 at 18:08