-1

i have made a custom form in my joomla admin panel and now i wanted to know how to call that admin form in the frontend. Other than using:-

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );

Please tell me the solution for it....

Oh What A Noob
  • 507
  • 1
  • 10
  • 33
  • Would you also like to share some code with us? Also please note that DS is deprecated. Just use / – Valentin Despa Feb 07 '13 at 08:58
  • Without some details we would be just guessing and wondering... How have you made a custom form? Is it a component or have you just hacked something together? – Craig Feb 07 '13 at 10:30
  • I have made a custom contact component extension in joomla 2.5 and just wanted to know whether there are any alternative of accessing or calling admin view form layout in frontend or not other than require – Oh What A Noob Feb 07 '13 at 11:07
  • 1
    If you have made a custom contact component, then the backend should be for editing and configuring it, and the frontend should be for the actual form. What you have done is not how Joomla is supposed to work. Read up a little on MVC structures – Lodder Feb 07 '13 at 12:16
  • 1
    In my backend, i have made a contact form creator in which i can make a different kinds of form and then i want to call that particular contact in my frontend..Have you seen rsform? I have made like that in joomla. I won't say that it is completely like that but the functionality is same.. – Oh What A Noob Feb 07 '13 at 12:50
  • My only concern was that are there any other ways of calling administrator views other than using require_once or not? – Oh What A Noob Feb 07 '13 at 12:57

1 Answers1

2

You absolutely need to build the frontend of the component, then in the component's controller you can instantiate the backend models if you need it, so there won't be too much code duplication.

JModel::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_yourcomp/tables');
$model = JModel::getInstance('somemodel');
Riccardo Zorn
  • 5,590
  • 1
  • 20
  • 36