I'm getting mad with this issue.
Basically there are some css and js files which are opened correctly from laravel. But some other js and css files are recognized as routes!
For example: http://localhost:8000/assets/ammap/themes/light.js
I'm using the following code to access assets from templates:
<script type="text/javascript" src="{!! asset("assets/ammap/themes/light.js") !!}"></script>
Obviously the path is correct and the file exists.
I've solved the problem.
I'm using OS X and it was a permission issue.
chmod -R 0777 public
Then set everyone to "Read & Write" into file permissions.
Related
I am using Angular UI Bootstrap with my Laravel Framework 5. I am using Rating directive. I see following error :
TypeError: Cannot read property '0' of null
at Object.ib.functionCall (angular.js:12405)
at n.$get.n.$digest (angular.js:14300)
at n.$get.n.$apply (angular.js:14571)
at eg.$$debounceViewValueCommit (angular.js:23391)
at eg.$setViewValue (angular.js:23363)
at HTMLInputElement.l (angular.js:19784)
at HTMLInputElement.m.event.dispatch (jquery.js:4670)
at HTMLInputElement.m.event.add.r.handle (jquery.js:4338)(anonymous function) # angular.js:11655$get # angular.js:8596$get.n.$digest # angular.js:14326$get.n.$apply # angular.js:14571eg.$$debounceViewValueCommit # angular.js:23391eg.$setViewValue # angular.js:23363l # angular.js:19784m.event.dispatch # jquery.js:4670m.event.add.r.handle # jquery.js:4338
angular.js:11655 Error: [$compile:tplrt] http://errors.angularjs.org/1.3.15/$compile/tplrt?p0=datepickerPopupWrap&p1=template%2Fdatepicker%2Fpopup.html
at Error (native)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:6:417
at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:65:275
at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:112:113
at n.$get.n.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:126:15)
at n.$get.n.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:123:106)
at n.$get.n.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:126:293)
at l (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:81:240)
at M (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:85:342)
at XMLHttpRequest.F.onload (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:86:367)
I think this error is coming because templates are not loading properly.
I have put "template folder" in root. I have also tried to put in "public" folder. But still same problem
Actual error from angular site is
Template for directive 'datepickerPopupWrap' must have exactly one root element. template/datepicker/popup.html
Please answer i am stuck. Thanks in advance
If you are using "ui-bootstrap-tpls.min.js", you don't have to include templates folder. Templates are wrtten inline in JS file.
add Angular UI bootstrap's css files in public/css folder and javascript files in public/js. then in your codebase when you need to load Angular's files type this:
<link href="{{asset('css/your-angular-ui.css')}}" rel="stylesheet">
and
<script type="text/javascript" src="{{asset('js/your-angular-ui.js')}}"></script>
if it's not working then it's not Laravel 5's problem. 100% sure.
I am new in CI - and the framework is awesome.
These are the best answers I can get:
- CodeIgniter: How do I include a .js file in view?
- Codeigniter: How to include javascript files
I am trying to include js/css files but:
My CI folder including application and system are not installed on the http(/var/www/)[for default installation] folder, I placed somewhere else. So i assume their installations above are in http default folder, I have :
http:/var/www
CI:
/opt/codeigniter
+aplication
+system
Thank you so much in advance
Use this code
<script href="<?php base_url().'path/to/file' ?>" type="text/javascript"></script>
The javascript folder should be outside the application folder
app_folder
-application
--views
--controllers
-system
-css
-js
Hope this helps
I am a absolute beginner of CodeIgniter, Now I was creating a simple project with CI. But I don't know how I can call a file that has existed in core folder.
Core folder is like the following
/core/bootstrap/bootstrap.css
I want to call bootstap.css from my view/admin/index.php
How I can call it?
I already try it like the following
<link href="/application/core/bootstrap/bootstrap.css" rel="stylesheet" media="screen">
but it still doesn't work.
You should not put your CSS files in the core folder. Best practice with CI is the following:
- application
- assets
-- css
-- js
-- images
- system
-- <all CI folders here>
Use a URL helper to point to the assets folder like:
function asset_url(){
return base_url().'public/';
}
more info on url_helpers
Then you can point to your assets in your view like this:
<link rel="stylesheet" href='<?php echo asset_url()."css/YOUR_FILE.css" ?>'/>
Look at documentation and read about url_helper.
Use internal links with function site_url() or base_url()
First of all I will not put my css files in the core folder.
I will create folder which is in the same level as in the "application" and "system" folder.
Secondly, you need to configure the base url at application/confi/config.php like
$config['base_url'] = 'http://localhost/NV/';
With in the folder "NV", I have my CI files such as "application" and "system".
Then in the view I will just use
<link rel="stylesheet" href="<?php echo base_url();?>css/ace.min.css"/>
In this case, the "CSS" folder resides as in the same level as "application" and "system" folders.
I have
<link href="/smarter-computing/us/en/sc-mobile.css" type="text/css"/>
<script src="/smarter-computing/js/sc-common.js?fileversion-r21" type="text/javascript">//</script>
When I am working on these files locally I have to keep append //localhost/~vc/ before the path for JS and CSS files. I don't want to keep copy/pasting this path for the following and every <img> links in my code.
How can I use htaccess to redirect all url's pointing to //localhost/smarter-computing/ or /smarter-computing/ to append this path //localhost/~vc/ before my /smarter-computing path.
Thank you,
Vishwas
You can either make the document root your home directory in your apache config in localhost, or add this to the header of your pages:
<base href="/~vc/">
So I have a module setup and working, and have setup an asset folder within it containing a css and js folder. My files are in there, but when I try linking to them like this:
<script type="text/javascript" src=/application/modules/badge_progress/assets/js/jquery.jcarousel.js"></script>
Or this:
<script type="text/javascript" src=<?php echo base_url(); ?>/application/modules/badge_progress/assets/js/jquery.jcarousel.js"></script>
They don't work. What is the proper way to link to the files?
You have a problem with your quotation marks. The src value starts with no quotation mark but ends with one. Try
<script type="text/javascript" src="<?php echo base_url();?>/application/modules/badge_progress/assets/js/jquery.jcarousel.js"></script>`
You cant access directly from /application folder from web browser.
Move badge_progress folder with same directory with application and try this
<script type="text/javascript" src="<? echo base_url();?>badge_progress/assets/js/jquery.jcarousel.js"></script>
keep your js and css file in root folder and try and check in firebug js file and css file is loading or not and what path is created for that file and then fix it.