Prestashop 1.7 include inline SVG in tpl file - svg

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!

Related

How to share html report of pytest-html with out changing the css

I am using python 3.6 and pytest-html to generate HTML reports .
Everything is successfully working but when i share my html report to my manager the css of the entire document is out of placed .can someone tell the reason to why it is happening and the solution for it .
The view of reports when i run:
The view of the reports when i share the document with my manager
include --self-contained-html when you are calling your pytest...such as
pytest your.pyfilename --html=pathandfilename --self-contained-html.
Your result file have inline css in it.
html=report.html --self-contained-html
It seems like you are not sharing whole bunch of items like CSS with html file you are giving. Just place the CSS code inside your HTML rather than giving the path and it will solve your problem.

css not getting applied for velocity template in Liferay Theme

I am using LIferay Theme to create a theme for a website.
IN the portal_normal.vm file, I have included all the html code and css I have defined in custom.css
THe problem is that css from custom.css is not getting applied to portal_normal.vm page
SHould I include some file in velocity file which tells that custom.css should be included?
Also is it ok to include all css code in velocity?
Regards
EDIT:
custom.css and portal_normal.vm are inside _diffs folder
put the custom.css under ~/theme/docroot/_diffs/css/custom.css
see the main.css in ~/theme/docroot/css/main.css it should include
...
#import url(custom.css);
...
It should work may be problem in browser cache.. try to run ant clean and then run ant deploy.
and also try to copy portal_normal.vm file to _diff/templates directory.
_diff/templates/portal_noraml.vm and change here.

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.

Yii module, theme layout include module layout. How to to that?

I need do something like that:
I have theme "panel" in /themes/panel and there layout /themes/panel/views/layouts/main.php with example content
<a>$content</a>
I have module "admin" in /protected/modules/admin and there layout /protected/modules/admin/view/layouts/main.php with example content
<b>$content</b>
And on the end i want
<a><b>view</b></a>
Also in /themes/panel/views/layouts/main.php i need load css file from module.
In other explanation:
I have one template for all panels (header, css files, footer), but each of panels need separate layout (only the middle of content change like menu etc.) and one or more individual css file.
Also some images will be include from main theme, other will be individual for modules.
You can use the renderPartial function for load the parts of layout.
<?= $this->renderPartial('webroot.themes.' . Yii::app()->theme->name . '.views.layouts.' . Yii::app()->layout . '.<PART_OF_LAYOUT>') ?>
I disagree that in many help forums of the Internet, when someone asks abot theming a module, everyone suggests a path alias to the themes folder. I think this is wrong, because it implies modules to be splitted, and modules are supposed to be a black-box that can be used across projects. The advice given in such forums would only be valid if a theme is shared among several modules. If someone wants to "package" a theme inside a module, she can:
-add an init function to the controller of the module
-inside that init, use the class attribute layout and a path alias, like this, supose a module whose id is "Sample":
then you add, to SampleCOntroller.php:
public function init() {
//BELOW: it will use the layouts/main.php inside the module.
$this->layouts = "sample.views.layouts.main";
}
Yo can check about path alias here:
http://www.yiiframework.com/doc/guide/1.1/en/basics.namespace

How to display html content in block in Drupal 6?

How can i display external(from server) html content into block region.
let me tell you what i did so far is i created a new block on my site called sitemap and put some php code
<?php include('../sitemap/sitemap.html'); ?>
and set this block region to footer.
But it show nothing so plz help me so i do it.
Maybe the include file path is wrong. For better results, you can put that file in the themes folder and call it.
<?php include(path_to_theme().'/sitemap.html'); ?>

Resources