404 status on bootstrap.js - javascript

I got this error from my bootstrap.js. what is the error and how can i fix this?
GET http://localhost/hr/public/js/booststrap.js index:12
status 404
My header code is,
<!--DOCTYPE html-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Login</title>
<link rel="stylesheet" href="<?php echo base_url();?>public/css/bootstrap-responsive.min.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="<?php echo base_url();?>public/css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="<?php echo base_url()?>public/js/jquery.js"></script>
<script src="<?php echo base_url()?>public/js/booststrap.js"></script>
</head>
<body>
<header>
Header
</header>
i am using code igniter on xampp.

I think you need to change the script tags to this:
<script src="<?php echo base_url();?>public/js/jquery.js"></script>
<script src="<?php echo base_url();?>public/js/bootstrap.js"></script>
And, as suggested by #wolfgang1983 make sure to edit the base_url in the config file to http://localhost/hr/

Related

How can I set PHP cookie with JavaScript in CodeIgniter

I want to set a PHP cookie through a button click event of JavaScript how can I achieve this. Is there any big minds can help me.
<script>
function openC(){
<?php setcookie('z', 'on', time() + (86000), "/" ); ?>
oopen();
}
</script>
<div class="row">
<div class="col-12 p-rel">
<button type="button" onclick="openC()" id="opner" class="btn hide btn-dark "><i
class="fa fa-bars"></i></button>
</div>
</div>
above is my code if I try to echo my cookie in another page like my header page I get nothing
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!--Favicon-->
<link rel="icon" href="<?= base_url() ?>assets/new_assets/images/favicon.png" type="image/gif" sizes="16x16">
<link href="<?= base_url() ?>assets/new_assets/css/style.css" rel="stylesheet" type="text/css"/>
<!--Site Title-->
<title><?php echo!empty($title) ? $title : ""; ?></title>
<p> <?php echo $_COOKIE["z"]; ?></p>
</head>
<script type="text/javascript">
var url = "<?php echo base_url(); ?>";
</script>

Error: summernote is not a function when using local files

I am having a really odd problem. When I used my local summernote files to load the text editor, ".summernote is not a function" happened. However, if I used the cdn files to load the editor, everything went fine. Here is my HTML header code:
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="UTF-8"/>
<title><?php echo $title; ?></title>
<base href="<?php echo $base; ?>"/>
<?php if ($description) { ?>
<meta name="description" content="<?php echo $description; ?>"/>
<?php } ?>
<?php if ($keywords) { ?>
<meta name="keywords" content="<?php echo $keywords; ?>"/>
<?php } ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
<link href="favicon.ico" rel="icon">
<!-- include jquery -->
<script type="text/javascript" src="javascript/jquery/jquery-2.1.1.min.js"></script>
<!-- include libraries BS3 -->
<script type="text/javascript" src="javascript/bootstrap/js/bootstrap.min.js"></script>
<link href="stylesheet/bootstrap.css" type="text/css" rel="stylesheet"/>
<!-- include font-awesome-->
<link href="javascript/font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet"/>
<!-- include datetimepicker-->
<script src="javascript/jquery/datetimepicker/moment.js" type="text/javascript"></script>
<script src="javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<link href="javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" media="screen"/>
<!-- include customer stylesheet-->
<link type="text/css" href="stylesheet/stylesheet.css" rel="stylesheet" media="screen"/>
<!--include customer js-->
<script src="javascript/common.js" type="text/javascript"></script>
<?php if ($styles) { ;?>
<?php foreach ($styles as $style) { ;?>
<link href="<?php echo $style;?>" rel="stylesheet"></link>
<?php } ;?>
<?php } ;?>
<?php if ($scripts) { ;?>
<?php foreach ($scripts as $script) { ;?>
<script href="<?php echo $script;?>" type="text/javascript"></script>
<?php } ;?>
<?php } ;?>
<!-- <link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.2/summernote.css" rel="stylesheet">-->
<!-- <script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.2/summernote.js"></script>-->
I tried to load the local files directly instead of echo them by PHP, but the problem is still there.
I checked every href, there is no dead link.
Then I created a pure HTML called test.html file underneath the javascript folder, and the text editor loaded fine by using local files.
By the way the framework I'm using is CI, and the file structure is:
root
├──javascript
├──bootstrap
├──jquery
├──summernote
├──font-awesome
├──test.html
I don't think you're including your scripts in the right order.
When you loaded from the CDN, your order looked something like this:
<script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.2/summernote.js"></script>
<script src="javascript/common.js" type="text/javascript"></script>
. . . which is logical, because you want to be sure that summernote is loaded by the time your main JS code executes.
However, your PHP dependency management code was injecting the tags linking to local files after that same script. Basically, dump all of that logic before your customer's script too:
<?php if ($styles) { ;?>
<?php foreach ($styles as $style) { ;?>
<link href="<?php echo $style;?>" rel="stylesheet"></link>
<?php } ;?>
<?php } ;?>
<?php if ($scripts) { ;?>
<?php foreach ($scripts as $script) { ;?>
<script src="<?php echo $script;?>" type="text/javascript"></script>
<?php } ;?>
<?php } ;?>
<script src="javascript/common.js" type="text/javascript"></script>
(Also note that in your PHP you wrote href instead of src for your script tag generation.)
For me, I wanted to use summer note with bootstrap4, I copied the below code from the official documentation but it didn't work, I realized afterwards that I was embedding a newer bootstrap version at the beginning of my page (I was reaching out to some bootstrap files located at the assets), I removed that line and everything went just fine:
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/summernote#0.8.18/dist/summernote-bs4.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote#0.8.18/dist/summernote-bs4.min.js"></script>

TypeError: $(...).circliful is not a function

I have a problem with a code. I want to import this statistic circles library in my web project. I am getting this error:
TypeError: $(...).circliful is not a function circle.js:2:2
I've imported all files correctly:
<script type="text/javascript" src="/wp-content/themes/storefront/jquery.circliful.min.js"></script>
<script type="text/javascript" src="/wp-content/themes/storefront/circle.js"></script>
Secondly I made my :
<div id="test-circle3"></div>
This is the circle.js:
jQuery(document).ready(function() {
$("#test-circle3").circliful({
animation: 1,
animationStep: 6,
foregroundBorderWidth: 5,
backgroundBorderWidth: 1,
percent: 88,
iconColor: '#3498DB',
icon: 'f004',
iconSize: '40',
iconPosition: 'middle'
});
});
Head section:
<head>
<script src="/wp-content/themes/storefront/jquery-3.1.1.min.js"></script>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<link rel="profile" href="https://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
<script type="text/javascript" src="/wp-content/themes/storefront/scrolling_nav.js"></script>
<script type="text/javascript" src="/wp-content/themes/storefront/styleswitcher.js"></script>
<script type="text/javascript" src="/wp-content/themes/storefront/js.cookie.js"></script>
</head>
change all js and css include path in your wordpress website like this.
old url
<script src="/wp-content/themes/storefront/jquery-3.1.1.min.js"></script>
new url
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/jquery-3.1.1.min.js"></script>

Include header.html to include multiple html pages

I have this bootstrap template: http://wrapbootstrap.com/preview/WB0412697
I have stripped out my header section in the index.html and placed it into it's own file named header.html.
I have tried using the techniques JQuery techniques located on these stack overflow pages and have no been able to get the page to render the header.html within the index.html:
- Make header and footer files to be included in multiple html pages, Common Header / Footer with static HTML and Include another HTML file in a HTML file
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
<title> Welcome...</title>
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon -->
<link rel="shortcut icon" href="favicon.ico">
<!-- CSS Global Compulsory -->
<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<!-- CSS Implementing Plugins -->
<link rel="stylesheet" href="assets/plugins/line-icons/line-icons.css">
<link rel="stylesheet" href="assets/plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/plugins/flexslider/flexslider.css">
<link rel="stylesheet" href="assets/plugins/parallax-slider/css/parallax-slider.css">
<!-- CSS Theme -->
<link rel="stylesheet" href="assets/css/theme-colors/default.css">
<!-- CSS Customization -->
<link rel="stylesheet" href="assets/css/custom.css">
</head>
<body>
<div class="wrapper">
<!--=== Header ===-->
<!--=== End Header ===-->
In between header and end header I have tried:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(function(){
$("#header").load("header.html");
});
</script>
along with the other examples within the aforementioned links as well as. I have also tried:
<!--#include virtual="insertthisfile.html" -->
which would have been really nice if it worked, as it seems very simple and
<?php include("filename.html"); ?>
but after changing the .html files to .php, my browsers only render plain text.
Any suggestions? What am I doing wrong?
you can make a php file like this. I expect you want the <head> staying the same as well
<?php
$header = file_get_contents('header.html');
$main = file_get_contents('main.html');
$footer = file_get_contents('footer.html');
echo $header;
echo $main;
echo $footer;
?>
then you can choose between different main content files depending on the $_GET using a if statement
<?php
$header = file_get_contents('header.html');
if($_GET['page'] == 'home'){
$main = file_get_contents('home.html');
}
else if ($_GET['page'] == 'contact'){
$main = file_get_contents('contact.html');
}
$footer = file_get_contents('footer.html');
echo $header;
echo $main;
echo $footer;
?>
First step : create div for footer and header
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
<title> Welcome...</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon -->
<link rel="shortcut icon" href="favicon.ico">
<!-- CSS Global Compulsory -->
<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<!-- CSS Implementing Plugins -->
<link rel="stylesheet" href="assets/plugins/line-icons/line-icons.css">
<link rel="stylesheet" href="assets/plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/plugins/flexslider/flexslider.css">
<link rel="stylesheet" href="assets/plugins/parallax-slider/css/parallax-slider.css">
<!-- CSS Theme -->
<link rel="stylesheet" href="assets/css/theme-colors/default.css">
<!-- CSS Customization -->
<link rel="stylesheet" href="assets/css/custom.css">
<script type="text/javascript">
$(function () {
$.get("header.html", function (respons) {
var header1 = respons;
$("body").append(header1);
});
});
</script>
</head>
<body>
</body>
</html>
Use simply PHP code:
<?php
// Include file with header
include("./include/header.php");
// This bit always includs to the "center" Call page file via URL
if (isset($_GET['page'])){
$file=$_GET['page'];
$file2= dirname($_SERVER['SCRIPT_FILENAME'])."/".$file.".php";
if(file_exists($file2)){
if(substr_count($file,"../")>0){
echo "Warning!";
}elseif($file=="index" or $file=="/index"){
echo "Warning!";
}else{
include $file2;
}
}else{
include "./include/404.php";
}
}else{
include "uvod.php";
}
// Include file with footer
include("./include/footer.php");
?>

Custom JavaScript not working in Joomla 3 template

i have problem with including javascript in joomla 3 template code. I am trying to create slider menu with http://9bitstudios.github.io/flexisel/. Outside of joomla with only html and java code, menu works great. But when i try to implement into joomla template i cant get it working.
My template code:
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/reset.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/style.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/flexisel.css" type="text/css" />
<?php
JHtml::_('jquery.framework');
?>
<script type="text/javascript" src="templates/<?php echo $this->template ?>/js/jquery.flexisel.js"></script>
<script type="text/javascript" charset="utf-8">
$(window).load(function() {
$("#flexiselDemo1").flexisel();
});
</script>
</head>
<body>
<div id="page">
<div id="head">
VOSSP
</div>
<div id="main-menu">
<jdoc:include type="modules" name="main-menu" />
</div>
<div id="footer">
</div>
</div>
</body>
</html>
I tryed using of $document->addScriptDeclaration and $document->addScript, from http://docs.joomla.org/Adding_JavaScript, but no change.
You are importing jQuery in noConflict mode, so try changing this:
$(window).load(function() {
$("#flexiselDemo1").flexisel();
});
to this:
jQuery(document).ready(function($) {
$("#flexiselDemo1").flexisel();
});
Note: go back to using JHtml::_('jquery.framework');

Categories