All Questions
204 questions
0
votes
3
answers
154
views
C: redefinition of function when using #include
I have encountered an issue in C that I am unable to recover, being "redefinition of [function]", and when I checked for a redefinition, I don't see any.
this always occur when the files are ...
-5
votes
2
answers
46
views
Replacing letters in a string using javaScript
function dnaStrand(dna){
const compl = dna;
dna.includes("A") && compl.replace(/A/g, "T");
dna.includes("T") && compl.replace(/T/g, "A")
dna....
0
votes
0
answers
54
views
PHP File Inclusion Issue: File not Executing as Expected
I'm encountering an issue where a particular PHP file, custom_functions.php, is not being executed within my project, resulting in unexpected behavior.
Problem Context
File Structure:
project/
│
├── ...
0
votes
1
answer
64
views
Import function from separate file in C++
I am trying to import the "Exponent" function from library.cpp to main.cpp, but I am getting
error: no matching function for call to 'Exponent'
else if (op == "**") {result = ...
0
votes
0
answers
16
views
PHP function in Include file and call via main file include in bottom
main.php
$x = 75;
$y = 25;
addition();
echo $z;
//include file in bottom of main page
include 'include_call.php';
Second Page - include_call.php
function addition() {
$GLOBALS['...
1
vote
0
answers
138
views
Using Javascript to remove navbar links to current page. Why does it only work sometimes?
I am using include to load my main navigation and footer onto all the pages of my website. I am attempting to use javascript to, on page load, change the color of the current page's menu item as well ...
0
votes
0
answers
63
views
multiple definition of `function' error occurring on the same line as "first defined here"
error log
paging.c: In function ‘setup_paging_structures’:
paging.c:7: warning: implicit declaration of function ‘printf’
rm -f bootimg
gcc -nostdlib -static boot.o paging.o x86_desc.o i8259.o kernel....
0
votes
0
answers
55
views
Wordpress: invoke function in a page / post
I rephrase my question in this new post to which I have not had any answer. These two functions create a page on the user's account endpoint. A table is published on this page. I would like this table ...
0
votes
1
answer
62
views
JS redirect function
I am trying to create a function that changes the redirect link of a button if the url contains the word "TicketPreDateable".
So I have a button like this one:
<div class="col-12 col-...
0
votes
1
answer
799
views
Numpy linspace function stop value
I giving start and stop values as parameters to the linspace function
Stop value is normally does not include in the array. Because of this we always write [stop+1] in order to make include the stop ...
0
votes
1
answer
4k
views
Fatal error: Uncaught Error: Call to undefined function that is not in a class
So i am working on some code and have come across this error and its starting to bug me a little as i cant find out what is wrong
i have 2 files main.php and that includes functions.php now in the ...
0
votes
2
answers
128
views
Can we just have a header file for the inline global function and that means no .cpp file?
I have to add a global function to my program. My global function body is quite small, so I'm thinking of using inline. As we can define the body of the inline function in the header, so to confirm, ...
0
votes
0
answers
66
views
WooCommerce: function with included php file doesn't get executed at the right time
For the past week I have been trying to solve a problem related to a custom php script for WooCommerce.
The goal is to add functionality to the bulk order and retrieve the orders I selected and print ...
0
votes
2
answers
68
views
Python: How do I include a function in another function?
I'm just starting to study programming and I have a question about functions. I defined the function leapyear as follows:
def leapyear(n):
# Given a year, decide if it is a leap year or not.
if n%...
0
votes
0
answers
61
views
PHP return from include file if a function fails
I have script.php which calls include(child.php). child.php contains a function.
Sometimes the function fails and produces an error message. If this happens I need to stop running child.php and ...
0
votes
1
answer
109
views
Eclipse gives undefined reference when calling a function in another c file
Im using eclipse for Linux mealtime system as target, and coding with C programming.
I made a c file (digital.c) and it has some functions inside it, when i try to call that function form my main. it ...
0
votes
0
answers
38
views
Compiler says parameter list is wrong, then in next sentence says function is an unresolved external symbol? How is this possible? How to fix?
I'm confused by this. The compiler is complaining about an unresolved external symbol... but if I add a parameter to it, it still knows to complain about the added parameter.
The function definition ...
-1
votes
3
answers
835
views
PHP exit only current included script file from inside a function
I know I can use return to exit current script file, but what if we want to exit current script from inside a function?
For example, we define a exitScript() function that prints closing html tags and ...
0
votes
2
answers
198
views
How do I link a Javascript file into another Javascript file
There are two files here in the same folder.
I am trying to invoke a function named greet of app1 in app2.
app1.html
<script>
function greet() {
alert('hello from App1')
}
// greet() ...
0
votes
1
answer
104
views
How to return value to index page from an included script page?
index.php
<?php
$surl = "http://myweb.com/myfolder/include.php";
$me_arr = array(array('method'=>'x', 'param1'=> 5, 'param2'=> 3),array('method'=>'y', 'param1'=> 2, 'param2'=>...
0
votes
0
answers
52
views
Call function via url in PHP
Index.php
<?php include("http://localhost/test/link.php"); ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
&...
3
votes
0
answers
45
views
Disable javascript function "add class on scroll" on subsite with php included header
I'm trying to disable a JavaScript function on certain subsites that change navigation background and text-color on the scroll.
It's defined in the header.php which is included in all sites, but at ...
0
votes
0
answers
14
views
MySQLi connection to database as custom function in a separate PHP file [duplicate]
Having some issues with a piece of PHP code that I'm using to learn about it a little more.
I have the following situation:
conf.php file with database connection details
<?php
$dbhost = "...
-1
votes
1
answer
30
views
functions and validating values
I'm working on having PHP validate negative values, numeric and non numeric and empty values in a value.
I need php to display error message if a value is negative, empty, non-numeric.
I'm also ...
0
votes
1
answer
479
views
output elements of an array containing particular letter in javascript
I'm new to javascript and I'm struggling with getting the syntax right on my function to pull elements from an array containing the letter 'i'.
let teachers = ["Arrington", "Kincart", "Alberts", "...
0
votes
0
answers
276
views
C++: Check / Assert a defined constant at its redefinition
I am currently trying to use two headers defining (partially) the same constants. Typically the constants should be the same but my plan is to add a check to be absolutely sure. The problem can be ...
0
votes
1
answer
44
views
PHP not getting the vars of include relativetime.php file but all other $lang vars outside relativetime.php are just fine
I have 2 functions first to detect language and other to convert time into relative time
index.php Is the file where i am calling the 2 functions with include_once
include_once('./backend/...
0
votes
1
answer
58
views
Can we use a header file without specifying its .h extension
For example ,we can use #include<stdio>instead of #include<stdio.h> in c , And can we used user defined function as a header file without specifying its extension,and add a file with .mp3 ...
0
votes
1
answer
52
views
Assigning a returned result for a function in a different file to a variable
I have a function in a utils file that I want to call and assign the exported result to a variable.
Currently, the variable is defined then I try to assign the return result but I am getting ...
0
votes
1
answer
8k
views
Method .includes() is not a function error
I am studying through Eloquent Javascript, and I have the following code as one of the exercices.
class Group {
constructor(){
this.arr = []
}
add(value){
if(!this.has(value)) {
...
0
votes
2
answers
129
views
include html in html with functions and css
I have a page made of a header bar and a navigation bar.
I want to include this parts into all of my subpages of my website without redoing it all over again.
For this, I´m using this code inside my ...
0
votes
1
answer
446
views
Global ASP function
I have an application programmed in classic asp. Now I need to create a new function that is accessible by all the files of my application, the problem is that I would have to add includes for all ...
0
votes
1
answer
148
views
Include a PHP function in Prestashop 1.7
I have a commercial site built using Prestashop 1.7. My boss asked me to add a function that gives a discount to a customer if her comes from another site.
I have found a tutorial that explains how ...
0
votes
1
answer
14
views
Using parameters of function in included file
Hey peeps I got a question about this in PHP.
first_file.php
<?php
function myFunction($a,$b){
include 'second.php';
echo $a;
}
myFunction(5,['Name'=>'Stefan']);
second_file.php
...
0
votes
3
answers
314
views
Qt Creator: include directories
I'm trying to create a GUI and i'm having issues with some header files that the program needs and uses.
If i click on the function in the main.cpp it takes me to the header file. But for some ...
1
vote
2
answers
841
views
Can't call a function from a separate file
I'm trying to run a function that's inside an included file. The file get's included properly but I still get a undefined function error. Tried everything and nothing seems to work. Here's a ...
-1
votes
1
answer
315
views
What is a clean way to have function1 call function2 and have function2 call function1?
My question is about recursion, but is slightly more complicated than than the typical case. Usually, a recursive function calls itself:
int functionName(int x) {
if (x meets condition) {
...
0
votes
1
answer
45
views
Getting the path of the original file folder not where it was included
I'm currently working on a PHP project in which i have a problem that I could not find a solution for.
here's how the project looks:
INC
functions.php
Main
index.php
In functions.php I have a ...
0
votes
0
answers
28
views
PHP Function not available on another page
I am trying to get a function to output on a page on my site.
All my functions are in functions.php, which I include in the head on all pages.
Here is an example function:
function get_username(){
...
2
votes
1
answer
365
views
Include php/html code or use function instead?
I am trying to figure out which is the best way to include some html/php code on some pages. For example header/footer and a couple other parts which are repetitive.
Should I include_once(php file) (...
0
votes
1
answer
45
views
PHP declared variable, to another file that's included via function
I have some kind of problem, but i don't get it.. I have an function for including/requiring files, which check is file already included and does exists:
function __include($fileclass, $is_required=...
0
votes
2
answers
85
views
PHP, Custom include function - how do I make all other functions & variables accessible?
I have designed a custom include function for my application, which was meant to make my life much easier except it's done the complete opposite and has resulted in me debugging the same type of ...
1
vote
3
answers
1k
views
Reusing a PHP variable from a function across files
I have a Wordpress site and I'm looking at 3 relevant files:
functions.php
header.php
index.php (includes header.php)
I'm pulling weather data from an outside feed with a function in functions.php ...
1
vote
1
answer
618
views
How does one insert fortran code from an external file into a separate code?
I'd like to have my code take code written in another document, read it, and then use it as though it was written in the code. Say we have the following:
MODULE samplemod
CONTAINS
FUNCTION ...
0
votes
0
answers
64
views
PHP function from included file [duplicate]
I think I read that one before, but can't find any infos on that issue.
I get an Error: Call to undefined function when I try to echo my function, from within an included file.
Setup:
bootstrap.php &...
0
votes
4
answers
804
views
Sharing a function in a folder in C++
Sorry for this question, which is probably a pretty nooby question, but i just don't know how to get my problem solved.
I have a function that returns true or false, rather the one number is a ...
0
votes
1
answer
726
views
Include HTML inside partial and inside function
I am creating some widget for Word Press, but maybe this is standard PHP question, because it is related to some MVC pattern. I have some HTML that i need to output on page but that HTML is for now i ...
1
vote
1
answer
335
views
PHP // Include file from another server if the standard-include server is down
I have lots of websites, where i use a lot of includes on. Those files I include are on an external include-server. My problem is: I want to make those files redundant, so if the include server goes ...
0
votes
1
answer
168
views
PHP Include and Class Scope
I am having a problem with var scope in a script iam developing, right now i think i will have to rewrite all my methods but lets see if someone can point me to the right direction.
file1.php
<?...
0
votes
1
answer
3k
views
php include multiple file with same function name
I have 3 php file
index.php file contain following code
<?php
include ('file1.php');
include ('file2.php')
?>
file1.php contain
function aa(){
sleep(5);
return 2;
}
function bb(){
...