My stylesheet not loading in Laravel - php

Hi everyone I'm a beginner in Laravel, I have a problem in the page master.blade.php, i.e., that CSS does not apply and when I open the source and I click on the link css it takes me to a HTML page
This is the source code :
This is the link of my css :

Remove all html code tags from your css file (<!DOCTYPE html>, <html>, <head> etc).
See some more information here: http://www.w3schools.com/css/css_howto.asp

try to do it like this
{{ url('css/custom.css'); }}
put ur css in the public folder ( public/css/custom.css ) same is for js

Hey everyone thanks for all, i fix my problem it's just in the folder public adding another folder assets and the style will be in this folder assets in the folder public not resources.
-like this :
public/assets/mystyle.css

Related

Two Similar CSS files in a website

I have one css file(reset.css) in my main page say index.php.
Inside index.php, I am loading another php page(secondary.php). Now the css in reset.css is not getting applied on secondary.php (Now sure why this is happening.)
I have two Questions here :
1.) Why secondry.php is not taking the reset.css styles.
2.) To resolve the issue, Is it OK for me to place another but similar reset.css file in secondary.php ?
Any help will be highly useful.
Code for Including secondary.php
$("#tab2_load").load('seconday.php');
First, add an id to your style tags like so:
<link id="someID" rel="stylesheet" href="refresh.css" />
Next, in Javascript add the following function:
function reloadStyle(s){
$('#someID').attr('href',s);
}
Now after this line $("#tab2_load").load('seconday.php'); call the function reloadStyle()
reloadStyle( 'refresh.css?v='+Math.random(0,100) );

CodeIgniter: My CSS file in my view not working

hallo I am running CodeIgniter 3.0.6 and this is my directory structure:
/application
/assets
/js
/mycss.css
/system
My default controller is loading this file in the index.php just fine but when i load another page, the whole page loads afresh but although this file is getting loaded, it is not doing what i want it to do. When i view sourcepage, the links are OK. What could be the problem. I am using base_url('assets/js/mycss') to load it
To put it simpler i have my default controller as welcome. In the index() method of this controller i have $this->load->view('template/index'). This works fine. Now if i load the same page in another method, uniserve(), in the same controller my css file does not do what i want it to do (my page layout is distorted) but all other css files are doing well. What is the problem here. Kindly help.
This link provide exact problem and exact code but my beyond.min.css is not working after it loads fine. How can i achieve the same solution provided in php's codeigniter? Thank you:
Why can't I load js and css files on my pages?
You could also use link_tag().
<?= link_tag('assets/js/mycss.css') ?>
will give
<link href="http://yoursite.com/assets/js/mycss.css" rel="stylesheet" type="text/css" />
And make sure that base_url is specified in your config.php file

index.ctp is styled but rest of the pages are not

index page is styled while rest of the pages are not.When i checked cascading style sheets(CSS) files in browser, I was surprised to see those CSS files are not accessible for all pages except of Index.ctp. All pages are in same folder and same links are given to access cascading style sheets then why those CSS files are not accessible for other pages.I tried enough to resolve this but could not. i tried to fin solution of this on Google but can't find any solution.
Include the stylesheets on default.ctp layout in View/layout not on index.ctp.
in your comment
controler name is FrontsController and folder iname is Fronts. css and js files are in css, js folders respectively. i using this way to add css file in about page. – user3623305 35 mins ago
add a comment
change path for css to be href="/css/reset.css"
Anyways it better to include your css files using html helper like this
echo $this->Html->css('css_name');
if your css file is at app/webroot/css, and it's name is main.css, use
echo $this->Html->css('main');
For more information look here http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::css

css files in webroot in cakephp and linking with html

I need a simple help with cakephp. It may be a problem regarding routes but I couldn't figure out how to solve this problem.
I've put all my css files in webroot/css in my app. In my default layout, I just put a html link <link href="css/bootstrap.min.css" rel="stylesheet"> . It works with my url localhost/items (index function), but it doesn't work when I do localhost/items/view/2 (view function). How can I solve this problem?
Use the HtmlHelper to generate links to assets in webroot as shown in manual.
Why don't you use the HTML Helper like :
echo $this->Html->css('bootstrap.min');
echo $this->Html->css('/assets/css/bootstrap.min');

Codeigniter URL index.php twice

Hi evrybody ‘im new to codeigniter and to MVC model as well,
I need help to get my project working couse i’ve got this issues:
1) i’m in the main page and i clik on the link of the “about” page, the css file does not seems to load.
and even if i include the css in the head section the images are still missing in the page.
2) in the configure file i’ve set the
$config[‘base_url’] = ‘’;
$config[‘index_page’] = ‘index.php’;
now if i’m in the about page and i clik again on the about link the link it’s missing becouse i set the link in the menu:
About
and so the index.php it’s loaded twice: localhost/mywebsite/index.php/index.php/about.
i could set the condition to cut the link if i’m in the page i need but i would like to know if there is a more polite solution
and hope that the solution it’s not to put my hands in to the mod_rewrite .
I’ll like codeigniter because seems to be easy to configure and so really portable.
and even if it’s simple i can’t figure out how to solve this issues
Thank you everybody for your time!
Even i a newbie to CodeIgniter. I was facing the css problem. I added the css files in separate folder located at the root directory. I solved the problem by adding $this->load->helper('url'); in the controller function of the page.
You need to set $config['base_url'] in config.php to http://www.yourdomain.com and provide full path when linking css to the page like this :
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/file.css">
just add
> <?php echo base_url();?>
before or or URL link
> (example: <script src="<?php echo
> base_url();?>assets/js/jquery-1.7.1.min.js"></script>)
to load the link to all page and separate the header and footer in separate file which could help you a lot minimize the page content.

Categories