Call module on needed page Opencart - opencart2.x

How to call module in Opencart 2.0 using his "ID"? I need to view the some modules not different places, I try find solution in google but no luck.

Put this one in your controller.
$data['anyvar'] = $this->load->controller('module/your-module-id');
And in your view file just echo it. like,
<?php echo $anyvar; ?>

Related

Prestashop 1.7 include inline SVG in tpl file

I am trying to include an SVG inside my tpl file like this :
<?php echo file_get_contents("icon.svg"); ?>
Do you have some idea ?
Finally, I found a trick to include inline SVG file using the template system.
So I just create a folder named _svg in the templates folder of the theme. I renamed my icon.svg file to icon.tpl and I included it using the following code:
{include file="_svg/icon.tpl"}
If you need a variable (for exemple in a loop, use :
{include file="_svg/icon-{$var.value}.tpl"}
If you have other ideas, do not hesitate to let me know !
See you!

Joomla 2.5 disable pagination?

I built a component in joomla 2.5 (back end) and even if I don't include code for pagination, my results aren't displayed fully (they are limited to about 20). Is there a way where I can have all my results show on default? Or in other words disable pagination? Thanks!
In your list model, set the list.limit state accordingly. By default it will use the global list limit.
You can use this code in the populateState() function:
$this->setState('list.limit', 0);
Please note that if you call parent::populateState($order, $dir);, this will also set the list.limit. So you either don't call the parent function or your set the state after the parent function was called.
firstly open your custom component view file, which is located in
/components/component_name/views/tmpl - file name is default.php and now comment this line
<?php echo $this->loadTemplate('_header'); ?>
and also
<?php echo $this->loadTemplate('_footer'); ?>
may very much help!
or another way is that goto joomla administrato - site - globle confi - Default List Limit
change limit

Broken links resulting from php include references

I'm learning php but am up against a wall right now with a referencing issue. I've searched a lot but I can't find any posts with my exact structural problem. Hoping to master this hurdle so I can move toward the next...
My basic file structure something like:
domain.com/
home.php
images/
global/
nav/
nav-img.jpg
includes/
menu.php
fruit/
apples/
red/
gala/
gala.php
I want to create a global path establishing my web root directory that I can reference on the fly in each page wherever it resides. BUT other posts on this general topic give [10] different functions I can use. I just want [1]. Also, I don't know where to put [for example] define(ROOT), or how to call it from an individual page.
Will define(ROOT) work for my situation?
Knowing that all pages use [menu.php], my obstacle:
From gala/gala.php - when I click on [home], it looks for:
/fruit/apples/red/gala/home.php [does not exist, of course!]
Also, trying to AVOID these [2] things if possible:
I. Using html file references in gala.php like this: ../../../../includes/menu.php
to find the correct global include.
II. And avoid using link references in menu.php like this: /images/global/nav/nav-img.jpg
Any feedback would be appreciated [+] or [-]. Thanks a lot.
Ok, here's what I did that seemed the best:
For I. and II. to avoid using so many ../../../../
in all the src="" and href="" I just settled and used site-relative file references with leading slashes, such as "/includes/menu.php" which would get me to the site root, building the file's location from there.
For the global file reference, BOTH of these worked:
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/";
?>
// in `<head>` section
And using <?php include ('menu.php'); ?>
OR THIS ONE WORKED TOO:
<?php
define('ROOT',$_SERVER['DOCUMENT_ROOT']);
define('INCLUDES',ROOT.'/includes/');
?>
// in `<head>` section
And using <?php include (INCLUDES.'menu.php'); ?> in a file at another level.

How to display modules only on search results in Joomla 2.5?

Hello please read the whole question, this isn't just solved by enabling the modules only for the search page:
I have a few modules that are exclusively shown on the search page in Joomla.
I created a hidden menu entry for the search as well in order to tell modules to only show on this page. This works alright, but when I click one of the results and get redirected to the actual result, then the modules, which should only show up on the search page are still shown in the result page.
Any clue how to fix this? Really annoying as I use 3rd party search enhancing modules, and they are showing on the results.
Using standard Joomla, there's no way to target modules to only the search results page and none of the pages that link off the results – but I know you knew that! The hidden menu item is a help, but does not change the menu item of some of the links off that page. It's all to do with the allocation and use of "Itemids" in Joomla.
To be able to target modules more specifically, you need to use a 3rd-party extension. I developed MetaMod (www.metamodpro.com) to cope with exactly this use case. MetaMod is a wrapper module that can then decide just which other module to include in itself (or not). So you assign the MetaMod to the page, then put a snippet of code inside the MetaMod which decides which other module to include.
In this case, I'd use the following in MetaMod:
if ($core_genius->check("pagetype = search, searchresults")) return XXX;
// replace XXX with the module id of the module to include
// ONLY on the search page, or the searchresults page, but
// no other type of page.
Hope that helps,
Stephen
Although MetaMod is great (I've used it myself & Stephen's support is great!) there is another way to do it without using 3rd party extensions.
You could create new module positions in your template above (or below) the module positions you wanted to use and wrap them in an if statement like so:
<?php if(!isset(JRequest::getString('searchword'))) : ?>
<jdoc:include type="modules" name="right-search" style="xhtml" />
<?php endif; ?>

drag and drop in drupal 6 block

I am working on drupal. I am facing problem in block. There is no drag and drop function on the page. When i dissable javascript on my browser it show weight option to set manually, after enable again it is not showing.
can any one suggest about this type of problem. if there is any css related issue please suggest me about this
Usually, when this happens, the <?php print $scripts; ?> call in your theme's page.tpl.php is missing, so that Drupal's JavaScript files aren't being included (it's JavaScript that creates the drag and drop features). Or there is an error/conflict in your JavaScript/jQuery.
Is $scripts being printed in your theme?

Resources