Common Link for JS and CSS files

Common Link for JS and CSS files

nutrabatchnutrabatch Posts: 6Questions: 3Answers: 1

I have a group of js and css links that i want to reference from one common file. I created css and js files containing those links and then referenced them into my pages using

<link rel="stylesheet" type="text/css" href="http://localhost/batch_2.0.5/Editor-PHP-2.0.5/main/assets/style.css">

It looks like the links are not being initialized properly. I am currently working with localhost using wampserver.

Any thoughts would be appreciated.

Thanks

Answers

  • kthorngrenkthorngren Posts: 20,246Questions: 26Answers: 4,760

    It looks like the links are not being initialized properly.

    are you saying the styles.css is not loading, ie, getting a 404 not found error or that the styling is being applied.

    For help debugging this please provide a link to your page or a test case replicating the issues so we can take a look.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • nutrabatchnutrabatch Posts: 6Questions: 3Answers: 1

    What I want to do is take all of these links that I have listed individually on each page and which I have to update individually on each page and put them into a common page that I refence on each page via a link and therefore only need to update once. Thanks

    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.0/css/jquery.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.0.0/css/buttons.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.3.3/css/select.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/datetime/1.1.1/css/dataTables.dateTime.min.css">
    
    
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.4.0/css/select.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/datetime/1.1.2/css/dataTables.dateTime.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/searchbuilder/1.3.4/css/searchBuilder.dataTables.min.css">
    
    <link rel="stylesheet" type="text/css" href="../../css/editor.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.dataTables.min.css">
    
    <link rel="stylesheet" type="text/css" href="../resources/syntax/shCore.css">
    <link rel="stylesheet" type="text/css" href="../resources/demo.css">
    
    <style type="text/css" class="init">
    
    </style>
    <script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.11.0/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/2.0.0/js/dataTables.buttons.min.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.3.3/js/dataTables.select.min.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/datetime/1.1.1/js/dataTables.dateTime.min.js"></script>
    
    
    <script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.4.0/js/dataTables.select.min.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/datetime/1.1.2/js/dataTables.dateTime.min.js"></script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/searchbuilder/1.3.4/js/dataTables.searchBuilder.min.js"></script>
    
    <script type="text/javascript" language="javascript" src="../../js/dataTables.editor.min.js"></script>
    
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
    
    
    <script type="text/javascript" language="javascript" src="../resources/syntax/shCore.js"></script>
    <script type="text/javascript" language="javascript" src="../resources/demo.js"></script>
    <script type="text/javascript" language="javascript" src="../resources/editor-demo.js"></script>
    <script type="text/javascript" language="javascript" class="init">
    
  • kthorngrenkthorngren Posts: 20,246Questions: 26Answers: 4,760

    What I want to do is take all of these links that I have listed individually on each page and which I have to update individually on each page and put them into a common page that I refence on each page via a link and therefore only need to update once.

    Understood. Maybe this tutorial will help. You can use the Download Builder to get all the Datatables related files into one concatenated CSS and JS file. Then combine the rest of your libraries. Keep in mind load order is important.

    You haven't explained what happens when you try this. Do you get 404 errors loading the concatenated files or are you seeing other errors - look in the browser's console. Can you post a link to a test case showing the issues so we can take a look?

    Kevin

Sign In or Register to comment.