I want to write <scrip></script> for API address form but I don't know where to write .
I created file a script.php in resources/views/script.php then I call
<script src= "{{ asset('resources/views/script.php') }}" >in app.blade.php but didn't work
Change your script.php name to script.blade.php then you can import it using #include('script');
Change resources/views/script.php to resources/views/script.blade.php
Then you can use the blade template engine :
#include('script');
Related
I'm using LynX39\LaraPdfMerger to generate my pdf files from a file named pdf.blade.php. When it's a normal html file everything seems to be good but once generate the pdf file everything is wrong and ugly. Is there any way to make the blade looks like the normal html file? You can see the 2 images below. Any help will be appreciated. Thanks.
to generate the file
$pdf = PDF::loadView('layouts.pdf_view', $data);
return $pdf->download('fiche' . '_' . time() . '.pdf');
pdf file
!https://drive.google.com/open?id=1309cGQl8sFPB22vFZTOdseBt-M7rCTjs
html file
!https://drive.google.com/open?id=1oSJFfRkKsraonATJa50ExH3yNN2HcQqH
do one thing change permission of css folder to +750.
then put css path like
<link rel="stylesheet" href="{{ URL::asset('css_public_path') }}" type="text/css" />
I'm using Laravel 5 with Blade templates. My templates look like so:
drone.blade.php
#include('drone.gallery')
drone/gallery.php
{{ url('images-gallery/DSC_0072.JPG') }}
However, the url() function does not work inside my include file. If I copy the {{ url('images-gallery/DSC_0072.JPG') }} line into drone.blade.php it works as expected.
Why is the url() parameter not working inside include?
Thanks in advance.
I can see your filename is gallery.php.
Can you plaese change it to gallery.blade.php
I have a form in my HTML, in the action, I would like to set the page where I want to send the data:
<form action="wherever.com" method="post" target="_blank" style="display: inline;">
The problem is Laravel, in my .env file I set this:
WHEREVER_FORM="http://wherever.com"
Ok, now I want to set this env variable in my ACTION, I have tried with this:
action="env('WHEREVER_FORM')"
Also this:
action="env(WHEREVER_FORM)"
And this:
action="{{env('WHEREVER_FORM')}}"
I know that I can do this from a env variable, but I donĀ“t find how to do it, in the Laravel Documentation I found this:
$env = env('APP_ENV');
// Return a default value if the variable doesn't exist...
$env = env('APP_ENV', 'production');
This is not enough to me.
Someone can help me?
I think your .env file setup is ok:
WHEREVER_FORM="http://wherever.com"
And also:
<form action="{{env('WHEREVER_FORM')}}" method="post" target="_blank" style="display: inline;">
However, Please make sure that you reboot your application after changing .env file. You can do this by:
php artisan serve
Is it possible to have the master.blade.php file outside of the template files.
Example below:
views/
master.blade.php
layout/
hello.blade.php
views/layout/hello.blade.php
#extends('layout.master)
I have tried the above but it cannot find the master.blade.php file. So is there a way to refer to a directory above the blade file.
it would be
#extends('master')
the "." in the view names indicate folders. so
#extends('my.long.path.to.template')
would be found in:
/views/my/long/path/to/template.blade.php
layouts don't have to be in a folder called layouts
I'm usinh a Prestashop 1.5.4.1, and I would like to call a module in other module (precisely I need to use slider module just above the home featured products). I tried to call it via
include file='../directory/module.tpl'
but always I get only blank page without any code. I also tried with different ways of directory statement, but always the result was the same. Is there any possibility to include new module in correct way?
For this to work, your directory structure should be (Using PrestaShop 1.6):
-- mymodule.php
-- views
---- templates
------ hook
------ displayFooBarTemplate.tpl
-------- inc
---------- foo.tpl
---------- bar.tpl
Absolute way:
From your main module file:
protected function displayFooBarTemplate()
{
global $smarty;
...
$smarty->assign('module_templates', dirname(__FILE__).'/views/templates/');
return $this->display(__FILE__, 'displayFooBarTemplate.tpl');
}
then in your tpl file (displayFooBarTemplate.tpl):
{include file="{$module_templates}hook/inc/modal/foo.tpl"}
{include file="{$module_templates}hook/inc/modal/bar.tpl"}
Relative way (my favorite):
{include './inc/foo.tpl'}
{include './inc/modal/bar.tpl'}
What worked for me in Prestashop 1.6 is
{include file="$tpl_dir/modules/blocknewsletter/blocknewsletter.tpl"}
I put this in the footer.tpl file and correctly displayed the text box for subscribing to the newsletter. I suppose it works for all other modules, too.
Proper way to include a smarty tag includes using the curl brackets.
{include file='directory/module.tpl'}
Note that the directory in the include statement should be relative to the templates directory.
http://www.smarty.net/docsv2/en/language.function.include.tpl
In your php code declare a variable like this :
$this->path_to_tpl_folder = str_replace('\\', '/', _PS_MODULE_DIR_) . 'mon_module/tpl';
$this->context->smarty->assign('tpl_path', $this->path_to_tpl_folder)
Then in your smarty template :
{include file=$tpl_path/my_file.tpl}
Compatible with Prestashop 1.4 and 1.5.