Jump to content

Search the Community

Showing results for tags 'require'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 7 results

  1. BACKGROUND: I recently installed chart.js using npm but had much trouble in do doing and would like now to verify that it is working properly. Accordingly, I ran the following two pieces of code followed by console.log(typeof myChart) in my browser's console. var Chart = require('chart.js'); var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, {}); and var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, {}); only to discover that the results were the same -- namely, object QUESTION: Is this telling me that the require statement is unnecessary, or is it telling me that no matter how you use the new expression it will always produce an object? OBSERVATION: Indeed, when I enter the chart.js sample code, the <canvas> item does not fill with the intended chart. Please advise. Roddy
  2. QUESTION: When a variable is passed via a super global from one file to another what happens to the variable that is passed? Where is it stored? What is its half-life? Roddy
  3. PHP beginner here. I have the following in index.php (the two files live in the same directory)... <?php require_once( dirname( __FILE__ ) . '/functions.php' ); ?> <!DOCTYPE html> <html lang="en"> <head> <title><?php echo $nds; ?></title> </head> <body> </body> </html> ...and here is the required PHP file (functions.php)... <? php // test variable $nds = 'Test title.'; ?> This gives me an "undefined variable" error when tested in a browser. Is this an issue of scope?
  4. Hello. I'm new to this community and I have just recently started learning PHP. I have run into the problem that the require statement doesn't seem to work: HTML 1:phplesson23.tmpl.php <!doctype html><html><head><style>li { list-style: none;}</style></head><body><h1>Join me in my journey to conquer the world!</h1><form action="" method="post"><?php if ( isset($status) ) echo $status; ?><ul><li><label for="name">Your name:</label><input type="text" name="name"></li><li><label for="email">Your email:</label><input type="text" name="email"></li><li><input type="submit" name="SIGN UP"></li></ul></form></body></html> HTML 2: phplesson23.php This is the one with the require statement. <?php if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {$name = trim($_POST['name']);$email = trim($_POST['email']); if ( empty($name) || empty($email) ) {$status = 'Provide a name and valid email.'}} require 'phplesson23.tmpl.php';?> What am I doing wrong?
  5. The code is as following: file:index.php <?php include("fix.php");?> file: fix.php <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="styles/styles.css" /> </head> <body style="margin:0px;"> <h1 style="background-color:red;margin:0px;">Problem</h1> </body></html> When I open file fix.php in firefox and chrome are ok (there is no margin between tag h1 and top boundary of browsers). However, when I open file index.php, in firefox is OK (no margin), but in Chrome, there a margin between them. Please, explain to me the reason. Is it because of the function require () ???
  6. I'm confused about require and require_once... Could you please tell me the practical example of require_once and require ?
  7. I know that require give an error and include gives warnings when something goes wrong. I assume require is used for something that you want on the page like a navigation bar or something that appears on multiple pages that doesn't change. I am trying to use include to use a function in another php file, but it seems it only works if I use all the functions in that php page. Is there any way to only use some of the functions and not all? Also, the once means it only shows up once, so any repeats will not show up. Does this apply to each page or the whole site altogether?
×
×
  • Create New...