I have a problem with the target tag of anchors. The anchor specification is:
<?php echo anchor(site_url('areaResponsable/perfil'), "Aquí", array('target' => '_self')); ?>
But, when I upload the project to the server, the links open in a new tab. And FireBug shows the next anchor:
<a class="external_link" target="_blank"
href="http://apps.manantiales.edu.ar/index.php/areaResponsable/perfil">Aquí</a>
Whats wrong, any ideas?
I checked your website http://apps.manantiales.edu.ar/index.php and did a wget for all your js files. I found that a library named gebo_common.js is setting any link with 'http' in it as an external link. Which using site_url will use http.
The file http://apps.manantiales.edu.ar/js/gebo_common.js on your server has jQuery code to set the class 'external_link' to absolute urls.
So do this:
echo anchor('areaResponsable/perfil', "Aquí")
Related
I'm trying to view a file that I have uploaded in a view but it shows 404 Not Found. It works fine in local but when I deploy it on heroku this error occurs. I tried php artisan storage:link but it is not working as well. This is the storage directory for the file:
storage/app/public/final_report/2_1_1_1613557659_Ruby Essay.pdf
My Controller:
//get the path for the current Peer Marks final report
$peer_final_report_path = $peer_assignment->final_report['path'];
$peer_final_report_path = "/storage/".$peer_final_report_path;
which the $peer_final_report_path will be /storage/final_report/2_1_1_1613557659_Ruby Essay.pdf
My View:
<!--Display peer marks final report using iframe-->
<div class="card-body" style="float:left;margin-top; 200px;">
<iframe id="pdf-document"
src="{{$peer_final_report_path}}" width="580px" height="800px" >
This browser does not support PDFs. Please download the PDF to view it: Download PDF
</iframe>
</div>
All help will be much appreciated.
Just try something like this.
Storage::url($yourfilepath);
When we do something like this:
Storage::disk('local')->put('file.txt', 'Contents');
How do you make a link to that file in a view? Something like this:
Download File
there are so many things in documentation and yet not even one example how to create a link to that file
Try this command on your terminal : php artisan storage:link, then laravel storage become public access.
Download File
UPDATE:
According to laravel docs, You can get the URL to the file like this:
use Illuminate\Support\Facades\Storage;
$url = Storage::url('file1.jpg');
Remember, if you are using the local driver, all files that should be
publicly accessible should be placed in the storage/app/public
directory. Furthermore, you should create a symbolic link at
public/storage which points to the storage/app/public directory.
Hope this helps!
Scenario--(working from a fresh Laravel 5.6 project install for reference):
With the existing default paths being /public and /storage/app/public and you want to physically store your logo.png image in the /storage folder and render it on your Welcome page, the process would go something like this:
In your terminal, navigate to your Laravel project folder.
Run command php artisan storage:link
Now create the folder /images in your /storage/app/public folder which gives you /storage/app/public/images.
Look in your /public folder and you will see the (shortcut) subfolders /storage/images
Copy a test image named logo.png into the /storage/app/public/images folder.
In your project's welcome.blade.php under /resources/views paste the
following code over the existing code:
<div class="content">
<div class="title m-b-md">
Laravel
<div>
<a href="/">
<img src="{{url('/storage/images/logo.png')}}" alt="Logo Image"/>
</a>
</div>
</div>
</div>
Save and open your project in your browser and you should see the logo image.
Having said all of that, later on you need a pdf folder to store uploaded pdf
files. Easy, just create a new folder in /storage/app/public called /pdf and
automatically the shortcut will appear in the /public folder. It is a once and "for all" solution.
I searched other posts and tried creating a helper function to create an asset_url as explained in this post, but no luck. I previously had to set the base site in my config.php file as such: $config['base_url'] = 'http://localhost:8081/ci';.
The code in my application\views\layouts\main.php file, just before the closing body tag is:
<script src=<?php echo base_url();?>assets/js/jquery.js"></script>
<script src=<?php echo base_url();?>assets/js/bootstrap.min.js"></script>
I'm running on XAMPP. I had to change the port number to 8081 after installing visual stuido and it conflicted with the default port 80. So my exact queston is what else can I do to resolve the 403 forbidden access in code igniter so that JS and Jquery scripts will work?
I set up a codeigniter project on my wamp www folder
The assets of my project is in 'assets' folder which is in the same folder as the application folder.
However when I access my localhost, the css,images and js which are in the asset folder is unable to load.
When I type localhost/assets instead, I can access them.
I set http.conf in the apache folder to set to "Allow from all" as well.
when i access the url from the developer tools for chrome, I have characters within the url like this
%3C?=%20base_url()%20?%3Eassets/img/a.jpg
Any idea what is wrong here?
It seams that the function base_url() is not executed and just printed in your view.
Try to enclose the function in a php block and echo it out with the path to the asset.
<?php
echo base_url() . 'assets/img/a.jpg';
?>
Or as stealthyninja mentioned in the comment, the short-open-tag you used is interpreted as text.
You can enable it in the php.ini with
short_open_tag=On
When you can't modify the php.ini, you can enable it in the codeigniter config.php with
$config['rewrite_short_tags'] = TRUE;
Now the short open tags are interpreted right
<?= base_url() . 'assets/img/a.jpg' ?>
check you config.php file:
$config['rewrite_short_tags'] = TRUE;
or try this :
<?php echo base_url()?>assets/img/a.jpg
I can't manage to include a javascript in an article(directly in the wysiwyg editor) using jumi.
What I've tried:
{jumi /path/to/file.js}
{jumi [/path/to/file.js]}
{jumi /path/to/file.js}{/jumi}
{jumi [/path/to/file.js]}{/jumi}
"file.js" is located in a folder in the same directory as Joomla.
I'm using joomla v. 1.7.3 and Jumi 2.0.6.
Is there something I'm missing?
I'm not sure if this solution is much different than yours, but you can got to the Jumi Application Manager and create a new entry like this:
<?php
$document =& JFactory::getDocument();
$document->addStyleSheet('path/file.css');
$document->addScript('path/file.js');
?>
Then add this to your article:
{jumi[*5]}
Where "5" is the id of the Jumi entry.
At least this is how I do it in Joomla 1.5...
I've found a workaround, it's not elegant, but it works:
create two files, 1 php which will echo a script element and a javascript file that you wish to include
in the article put:
{jumi [path/to/a/php/file.php]}
the php file should be
<?php
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"path/to/js/file.js\"></script>"
?>
Enjoy!