Please Help.
I want to access css,js and images in root folder laravel.
in the root folder laravel i have folder themes.
for view not problem but when i'm accessing css,js and images. not working.
when i clicked link css. i'm getting not found
Hierarchy for themes
the asset() helper will look for the required path at the public dir
your themes path should be something like that
project-path/public/themes/..
Related
-- Images
-- Project Folder assign in url web (ex : abc.com)
Try to access path file in Images like "/../Images/ABC.png" but the url in web becomes abc.com/Images not assign folder images outside project folder.
So, can someone help how to access the folder images outside?
Just create a folder in codeigniter root directory.
An example: I created a folder called "assets" inside codeigniter & upload a image in this folder. Image name is photo.jpg.
Now you can use in view. So base_url automatically replace with your website url.
Note: Must enter your website base_url in app.php
I have laravel installed on my server and I want to add a folder called 'projects' in laravel's root folder and access the projects folder from URL.
What should I do to solve this issue? I want to upload some PHP code demos and allow people to view them.
I have tried playing with the .htaccess but nothing seems to work for me.
public_path(); // Path of public/
base_path(); // Path of application root
app_path(); // Path of app/
I have a ROOT, which has path of my project. Now, I am inside subfolder, and assets is outside of the subfolder. so how to get outside by using ROOT.
// output of ROOT is G:\xampp\htdocs\admin_main\
MY current folder is G:\xampp\htdocs\admin_main\dashboard\agent\manage.php
In manage.php I have multiple image tags and my images are in assets, which is in admin_main folder.
I can go easily by using like this
But, my task is to do that by using ROOT.
You can access the parent directory with ../
Since you made an edit to your post, this should work:
$path = "../../assets/"
but since I guess you're using this inside HTML only, you can do:
<img src="/assets/img1.jpg" />
I'm new in Symfony and my problem is simple, I just can't load images from a certain directory and display it to twig. I have this upload folder located in the root directory of my Symfony project (outside of web folder). This folder is just a link to other VM through Linux file system and which has the original upload folder. I've tried to check if it exists using php's
file_exists('/var/www/html/<projname>/upload/somefolder/image.png');
and it shows that the image exists but when I'm trying to display the images in twig, it always shows 404 error not found and the image is not displaying. I've already did this:
<img src="/var/www/html/<projname>/upload/somefolder/image.png" />
and
<img src="/upload/somefolder/image.png" />
How does symfony handle this situation?
If you want to get the path of your root directory you can try below code. Here is a best example provided for file uploading.
$this->get('kernel')->getRootDir() . '/../web' . $this->getRequest()->getBasePath();
Might be this can also help you.
I would suggest using asset() (see https://symfony.com/doc/current/templating.html#templating-assets), but this also requires you to put your folder under projects web/-directory so it could be accessed by symfony and webserver (in combination).
Since you're using a linux, it's simple as that:
cd /var/www/html/<projname>/
ln -s upload web/upload
Now you can simply reference to your assets like:
{{ asset('upload/somefolder/image.png') }}
I am trying to install Laravel 5.3 in sub domain /public_html/mysite
but it's not working should I change .htaccess or what ?
Put the content of public (L5) directly on public_html (be aware of don't overwrite the .htaccess file accidentally) Now in then modify your index.php and your bootstrap.php and it will work just fine
I hope #Nino Armani gave you the right answer. Although you can try with visual video tutorial here-
http://www.tisuchi.com/upload-laravel-projecy-cpanel/
Move everything from project/public folder to project/ folder
Update index.php to have bootstrap path like "./bootstrap"
Add base APP_URL in your .env
Update layout folder paths like {{URL::to('/css/app.css')}}