Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 342 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I load a template of a view within another view in a component?

#1
I am trying to add a view that I made (a table) to another view that I need to appear again. How can I do this? Actually I am trying to add a view within another view using theloadtemplate function.

This is what I type inside the view, but it does't seem to work, can anyone help?
The message I get is the following

> Layout default_reports not found

<div>
<?php $jinput = JFactory::getApplication()->input;
$jinput->set('view', 'reports');
echo $this->loadTemplate("reports");
$jinput->set('view', 'master');?>
</div>

But the view is there...
Reply

#2
Using the `loadTemplate` function, we call only the layout inside the view.

We concatenate two or more layout using the loadtemplate inside the following view.

By default joomla, it call the layout by a prefix as `default_`. So we have to create a layout as reports means filename as `default_reports.php` but we need to call the layout as you have mentioned

echo $this->loadTemplate("reports");
Reply

#3
If you want to be able to load "layouts" from another "view" in the current `view.html.php` file, then you can do so as below.


$this->addTemplatePath(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'anotherview' . DIRECTORY_SEPARATOR . 'tmpl');
$this->setLayout('layoutfromanotherview');
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through