FAQ Database Discussion Community


C: Why do we include header files, which declare but don't define?

c,include,header-files
At a high level, I understand we use #include statements to make code from other files available to the current file. But I don't understand why we include a header file, which contains declarations but no definitions. Maybe I need to learn more about the compilation/linking process to fully understand...

Changing title based on included file in PHP

php,include,title
I have to make some changes on my old website where I'm not using any templating system. I'm loading the content for some pages from a database based on ?page parameter. So I have something like this: <title>Page title</title> ... ... ... $page_id = $_GET['page']; include 'page.php'; //escaping is done...

Composer Autoload Issue

php,class,include,composer-php,autoload
I've added composer to an existing project that uses the PHP autoload function. Now that composer autoload.php is being used I've removed my old autoload function and I'm trying to load my existing source directory via composer autoload but it isn't picking up any of my existing source classes. Everything...

Multiple definition and file management

c,arrays,compilation,compiler-errors,include
I'm writing a program for vocabulary training, for myself. And the program itself should be available in different languages, atm in German and English. What I want is to have a Main File which manage all and two separate files for the functions in the right language. I compile all...

PHP how to echo an image and text file from each subfolders as a table

php,html,include,echo
I'm totally new to PHP and not an Advanced web developper but I really like to learn. My problem is the following: I want to make a projects page which would show every projects located in subfolders. In clear, that page would include a thumbnail and a two lines description...

Correct way to import file from different directory in Cython

python,include,cython
I have a .pxd file which contains declaration of a variable in another c header file as can be understood from the following code: cdef extern from "parameters.h": ctypedef struct mm_np: int nlay double n1 double n2[3] double d[3] double n3 int lut when the file parameters.h is in the...

Where is the -I (captial i) path relative to in g++?

c++,include,g++,preprocessor,header-files
I am in the App folder of my project. I run the following command to compile character.cpp g++ -Wall -std=c++11 -I../App -c Character/character.cpp -o Obj/character.o which is in App/Character directory. character.cpp has the following include #include "Inventory/inventory.hpp" where the folder of inventory.cpp is App/Inventory. I thought because I am running...

PHP5: How come an included function always echoes first if I call it?

php,include,echo
I've got two files here: ToBeIncludedFile.php <?php function printOut(){ echo "World!"; } ?> MainFile.php <?php include("ToBeIncludedFile.php"); echo "Hello ".printOut(); ?> I would expect "Hello World!". Instead I get this: "World!Hello ". I know if I write return instead of echo, then everything is fine. Is it because I'm echoing a...

include once inside echo [closed]

php,string,include,echo
I have two headers which I'd like to display according to account type; "a" for admin type and "b" for regular user type. I already have the enum set 'a','b'. Now, for the php after connecting to the database, I have: <?php while ($row = mysql_fetch_array($sql)){ $name = $row["name"]; $accounttype...

include fails if file is in another directory

php,include
I am trying to include a php file that has some functions in it. My original plan was to store it in a different directory, but when I do that, include fails. Here is what I mean: var_dump(file_exists("/dir/functions.php")); // returns bool(false) var_dump(file_exists("dir/functions.php")); // returns bool(false) var_dump(file_exists("http://www.example.com/dir/functions.php")); // also returns bool(false)...

Including PHP with HTML not interacting correctly [duplicate]

php,html,include
This question already has an answer here: What is the difference between client-side and server-side programming? 3 answers I'm trying to include some PHP script in with a HTML file, while I have found the command that achieves this, there seems to be an error in the way that...

Variable not accessible in Included php file

php,variables,include
I have folder say 'a' and under 'a' folder I have 'b' folder. I have scripts in 'a' folder and in 'b' folder. a.php <?php $var = 'ss'; include_once('b/b.php'); ?> b.php <?php echo $var; // Not printing value, says undefined. ?> ...

Namespaces with multiple cyclic inclusion

c++,header,namespaces,include,forward-declaration
I've 3 classes that belong to a namespace "MyNS". "A" uses the "B" and "C", while both "B" and "C" use "A". Here are the structure of my headers: //mynamespace.h #ifndef SOMENAMESPACE_H #define SOMENAMESPACE_H namespace MyNS { class A; class B; class C; } #endif /*******************************************************/ //A.h #ifndef A_H #define...

Import stylesheet with php if a certain page is requested

php,css,import,include
I would like to import a css stylesheet in a page depending on a php condition (or other), this condition is based upon the domain URL. For example, if the page loaded is "mydomain.com/about-us" import a "css/about-us.css" file. I have tried with this code, but it does not work. <?php...

Is it possible to check whether a script of any version has been included?

javascript,jquery,scripting,include,greasemonkey
Earlier this day I wrote a small script for greasemonkey which fixes the sometimes buggy auto scroll in the StackOverflow Chat. I did // @require jquery......... however that lead to some problems since the chat is already using jQuery in a lower version which is not compatible with a newer...

Variable already defined in .obj, but no circular includes [duplicate]

c++,windows,class,include
This question already has an answer here: Why does global variables in a header file cause link error? 5 answers I know, there are a lot of similar problems and solutions already on SO, and I read them, but none of them helped me solve my problem. I created...

Silex - How to process template includes separately

symfony2,templates,include,silex
I've got a Twig base template like so: {% include "./partials/navigation.html" %} <!-- Main Wrapper --> <div id="wrapper"> {% block content %}{% endblock content %} </div> I also have a route controller which is outputting the response content to the page using twig: return template->render('path/to/teplate', args()); where args[] array is...

PHP Shuffle Include(ed) Files

php,include,shuffle,php-include
I'm trying to use SHUFFLE function to show FILE1.php or FILE2.php at random. Here is my code: <?php $banner1 = include 'file1.php'; $banner2 = include 'file2.php'; $banners = array( $banner1, $banner2); shuffle($banners); print $banners[0] ?> The problem I have - if instead of doing include 'file1.php'; i just use text...

LINQ to SQL: How to create something like conditional include?

.net,linq,entity-framework,include,condition
I'd like to create a query contains User whose entities has Event with type == 1. I would also like the Event entries loaded into EventsCollection. My code would be something like .Include(u => u.EventsCollection), but this only loads all Event entries - I want to load only with type...

How to access the class using include/require using php?

php,codeigniter,include
I set up all the basic setup for Codeigniter Framework. My Code: controllers/index.php: include "file_name.php"; //In my case APPPATH . "controllers/user/user_data.php" controllers/user/file_name.php: //In my case controllers/user/user_data.php <?php echo "Welcome"; class File_name { function index() { echo "this is index"; # code... } } Output: What I getting: welcome What I...

Prevent that anybody can open include file directly in his browser

php,file,include,access-rights
I have a file named startpage.inc.php and I want to include it but prevent, that anybody can open it in his Browser. Is it possible? Possible: <?php include 'inc/startpage.inc.php'; ?> To prevent: www.example.org/inc/startpage.inc.php ...

PHP: Change specific line of txt File with ID

php,include,explode
im searching for almost 2 hours for an solution for my problem. i have a text file with a few lines: Title1|||Content1 Title2|||Content2 Title3|||Content3 But now i want to change 2 specific line, for example Title2||Content2 i will send the id via url. so i know which line, but i...

How to include a class from a subproject

ios,xcode,class,include,subproject
(Xcode 6.1, Objective-C, iPad) I have an Xcode project with another project--a subproject. I am trying to #import a class from the subproject in the usual way: #import "myAwesomeClass.h" But I'm getting an error: 'myAwesomeClass.h' file not found. When I open the subproject, the class is right there in the...

Best Practice for Including Javascript and Concatenate

javascript,module,include,concatenation,gulp
I have a medium sized project and I want to divide my fairly long javascript file into several submodules. Afterwards I want to concatenate all my js files with gulp.js and also minify them. I also would prefer not to use a watch task to concatenating my js every time...

Gnu make: is it possible to delay include directive to secondary expansion?

include,make,gnu-make
I need to delay inclusion of dependency fragments until second expansion time because the make file I'm editing is itself an include file and I will not have a list of source files to generate the includes until secondary expansion. .SECONDEXPANSION: AUTO_DEPENDENCY_FILES = $(patsubst %.cc, depend/%.d, $(CC_SRC_FILES)) # the following...

OpenCV - Method 'knnMatch' could not be resolved

c++,opencv,include
I have just a little problem with the right resource. I am using opencv 2.4.8 and I couldn't find the right resource for knnMatch(). I tried the following which didn't work: #include "opencv2/core/core.hpp" #include <opencv2/nonfree/features2d.hpp> #include "opencv2/nonfree/nonfree.hpp" #include <opencv2/ml/ml.hpp> //#include "opencv2/features2d/features2d.hpp" //#include <opencv2/legacy/legacy.hpp> Can someone say me the right resource?...

index.php doesn't show header or footer only on first call

php,html,include
strange problem: on the first call of my test homepage http://risklantern.eu/index.php, it doesn't show either header or footer (and sometimes just not the header). Here's the code: <body> <div id="wrapper" class="hfeed"> <?php include ("/titlebar.inc"); ?> <main id="content"> Main page goes here </main> <?php include ("/footer.inc"); ?> </div> </body> If I...

How do I add Arduino libraries to Eclipse Project?

c++,c,eclipse,include,arduino
how do I add Arduino libraries to Eclipse Project? I just started playing with Intel Edison and have a Grove developer kit with an LCD that I can't use, because the library is missing. ...

What to use in the absence of “include”

vb.net,class,include
So, I'm writing a small program in VB.net and I was wandering if there's a replacement for the include statement I'm used to in C/C++? That's instead of making all my classes and functions "public shared". Are their security concerns, or is it bad practice to keep declaring all the...

how to use array by included file in php?

php,arrays,include,return,require
I have a init.php file with the following code: $engines = [ "id" => [ 'A', 'B', 'C' ], "url" => [ 'D', 'E', 'F' ] ]; return $engines; as you can see in this file there is only an array that need for initialize the site that is included...

Having trouble with includes and relative paths

php,include,relative-path
I'm building out a very small page that will live for the duration of a 5 day conference. Each day the site needs to load new content so I'm using a small script to load in an include file. I'm trying to get my includes to be relative paths but...

Prestashop custom php file with query

php,include,connection,prestashop,require
I am new to prestashop and I have made a custom php file which is called by ajax and has SQL queries. The problem is that this file doesn't have a connection. What should I include or require in it to achieve it?

Know where the Actual Code Broke In an imported function in PHP

php,include
For instance, I have a simple include file that has a function: function ViewInclude($file){ require_once $file.'.inc.php'; } And, another file (say index.php) that uses the function: require_once 'inc.php'; ViewInclude('header'); When the require fails, Warning message is as: Warning: require_once(header.inc.php): failed to open stream: No such file or directory in ..../tests/inc.php...

PHP Include not working properly

php,wordpress,include
Recently i ordered a webserver, because i needed a mail function to work on a PHP Wordpress plugin. So i moved everything from my localhost to the webserver, but for some reason an include doesn't work anymore. The file i need to include is in: /domains/brentlobbezoo.nl/public_html/wp-content/plugins/dnhadmin/connectie.php The website i'm including...

Should I Inflate or a new layout on top of my main layout?

android,android-layout,include,layout-inflater
I am a bit confused regarding the rendering of other layouts inside my application's main layout. I know inflate, which I use quite often, but a few days ago I came across < include /> which can be used directly in the application's main xml layout, it quicker and cleaner....

include same header in 2 files .c

c,header,include
c files : Primitives.c, bloc.c and main.c And 2.h headers: bloc.h and primitives.h I want to work on Primitives.c and use bloc.c functions i made#include "primitives.h"in primitives.c In primitives.h I have : #ifndef PRIMITIVES_H_ #define PRIMITIVES_H_ #include "bloc.h" #endif In bloc.h : #ifndef BLOC_H_ #define BLOC_H_ ... #endif In primitives.c:...

Compiler can't find libxml/parser.h

linux,include,debian,libxml2,suse
I am on Debian 8 (Jessie), 64 Bit. I installed libxml2-dev, which now sits in /usr/include/libxml2/libxml. But when I do (just like libxml docs say) #include <libxml/parser.h> I only get when compiling (with gcc) fatal error: libxml/parser.h: no such file or directory Notes: On another machine, with an old 64...

Can I assign an include_once file to a $var with PHP?

php,model-view-controller,view,include
I am trying to roll my own MVC purely for learning purposes, but am hitting a snag when I try to load in the view files. Here's my problem: Front controller grabs appropriate page controller, page controller include_once() the appropriate view. The view is a file containing HTML and PHP....

Can't get Error message in PHP

php,include
I have a login Form index.php which has input as ID and Password.I get the input and submit it to another File called login_user.php which accepts the data. If the Credentials are correct then User is routed to the home Page correctly. But when the user has put wrong login...

can i access Module class method from controller just by calling the method?

ruby-on-rails,module,include,request
I have the following module inside lib/api_client: request.rb module APIClient class Request require 'digest/sha1' require "net/http" require "uri" def self.venues_response ... end end end wich i include in my controller class like this: class VenuesController < ApplicationController include APIClient I'd like to access it's methods from inside venues_controller like this:...

PHP: path is incorrect while running script from cron

php,linux,cron,include,filesystems
I'm having a strange problem. When I call script with http request (from browser) it works as it should. But when I'm calling it with cron include starts complaining on paths. Why can paths be ok while running the script in a common way an incorrect in cron? I've tried...

PHP include leaving invisible character footprint

php,json,include,echo
I am setting up a game server on my dedicated server using PHP and I have run into this problem. I have a script that I run to get the game state as JSON. To save bandwidth and processing time, I decided that on the update script, I want to...

Compile errors when including std::mutex before jemalloc.h

c++,c++11,include,std,ratio
This //CSocket.h #ifndef __SERVER_CSOCKET_H__ #define __SERVER_CSOCKET_H__ #include "winsock2.h" #include "ws2tcpip.h" #include <thread> #include <stdio.h> #include <string> (cpp includes only the header) //CSocket.cpp #include "CSocket.h" produces the following error messages in c:\program files (x86)\microsoft visual studio 12.0\vc\include\ratio ratio(122): error C2065: 'INTMAX_MAX': undeclared identifier ratio(133): See reference to the instance of the...

Loading a c program in another one

c,include,codeblocks
I have written a program and i want to link it to another c program. In the sense, by using the include or any other directive, I need to link the programs, such that a function of the former can be called by the latter. How can i accomplish this...

How to include boost libraries?

c++,boost,include
I'm trying to incorporate the boost libraries into my program, specifically lexical_cast and geometry. I include them using #include"boost/boost/geometry.hpp" and #include"boost/boost/lexical_cast/lexical_cast_old.hpp". When I run the code I get the fatal error "Cannot open include file: 'boost/geometry/geometry.hpp': No such file or directory" which leads me to another .hpp file in the...

warning : Implicit declaration error [duplicate]

c,include,warnings
This question already has an answer here: warning: implicit declaration of function 2 answers Here's the files , i want to use includes : primitives.h: #ifndef PRIMITIVES_H_ #define PRIMITIVES_H_ #include "bloc.h" #endif primitives.c #include "primitives.h" Bloc_T creat2(char* ,BT_T); Bloc_T creat2(char* nomfic ,BT_T typefic) { Bloc_T Nouv_Bloc; setTitreMeta(Nouv_Bloc.infosFic,nomfic); Nouv_Bloc.typeBloc= typefic;...

Expand define macro with include macro

c++,c,macros,include
I'm trying to define a macro. The idea is that when it expands, it'll include a header. For example: #define function() \ include <CustomHeader.h> Thanks a lot....

Type constraint for module inclusion in OCaml

types,module,include,ocaml
I want to define the following module hierarchy, but it does not work : module type A = sig type t end module type B = sig type u include A end module type C = sig (* Error: Unbound type constructor u *) include B with type t =...

Definition of Include file

c++,c,include,header-files
I have seen a separation of header files in two Visual Studio folders,Include Files and Header files, where headers with public API have been in Include Files folder and others in Header files folder. Is the term "include file" used and recognized this way? What I have seen is just...

How to create an “include all” file?

php,include
I would like to create "include all" file, and then from each "real" file instead of including bunch of files each time, include just created "include all" file. Take a look at the example -- inc.php: <?php require_once('A/a.php'); require_once('A/B/b.php'); ?> A/a.php: <?php require_once('../inc.php'); ?> A/B/b.php: <?php require_once("../../inc.php"); ?> However it...

How should I declare global variables in my C++ project?

c++,c,include,global-variables,header-files
I have two matrices as global variables. However, when I run my project, I get a apache Mach-O linker error in xCode that says that my global variables are declared more than once. I've determined the problem to be the placement of my global variables and the imports of the...

Exception with JavaFX jar

jar,javafx,include,export
I have export a FX Project as Jar, this exception show me. http://www.bilder-upload.eu/show.php?file=4eae98-1432897954.png http://www.bilder-upload.eu/show.php?file=aace07-1432898009.png I have tested an easy FX project without includes without errors. I believe its about wrong includes path. Do you have got any idea what i did wrong? Update Here is the code where the FXML...

Where is kernel.h?

c++,linux,include
I'm trying to understand (a little) C++ langage (or C, not sure..). The working folder is ~/ANDROID/lichee/linux-3.4/arch/arm/mach-sun7i In a file named device.c, there is this line: #include <linux/kernel.h> But no linux folder anywhere. Where is this kernel.h ?...

Link multiple php files to a single stylesheet?

php,html,css,include
I'm making a simple website with 3 pages in php. The main page is index.php and the other two can be opened through index.php via links. The link to CSS is given in the index.php file and I want the CSS to get applied to all the other files as...

C include paths: Safe to use hyphen & underscore?

c,gcc,include,include-path
I realise that this may be operating-system specific, but I am trying to write cross-platform GCC code. So would like to know if it really is best to avoid these, or if am forced to choose, which would be the safer bet.

Jekyll include variables from external file

include,jekyll
With Jekyll, I know you can include a variable in the include line, like so: --- layout: default testVar: test1 --- {% include test_block.html testDivContent=page.testVar %} Is it possible to include another file that passes in the variable content (in this case testVar: test1) from an external file? So something...

Is this possible with a pageswitch?

php,url,if-statement,include
Usually i would use url parameters for a pageswitch, lets say i got this switch so p is the page if(isset($_GET['p']){ $page = $_GET['p']; if(file_exists('includes/' . $page . '.php')){ // include the page } else { // include error page } } else { // include homepage } my url...

How come a simple PHP include file be vulnerable

php,security,include,whitelist
I have a header.php and a footer.php which I include into all other pages like home, contact, about us etc. The way I included the header and the footer file is <?php include 'inc/header.php'; some code some code include 'inc/header.php'; ?> Everything simple and works fine. I decided to check...

Cannot get include path working

php,include
I am trying to include a php directory that is currently in a subdirectory by either editing the php.ini configuration file or with the following method: string set_include_path ( string $new_include_path ) I am currently trying to use the above method and have placed it in a login.php (same subdirectory...

HTML / PHP: Which parts of an HTML head can be saved in a separate file

php,html,include,html-head
I am new to HTML and hope someone can help me with this. I am trying to set up a website where the code for every page is saved as a separate php file. Since all these pages use the same document head and includes I would like to remove...

PHP include class not working

php,include
I'm trying to use a php class plugin on my project. (Windows) https://github.com/mhor/php-mediainfo It is a very basic question but I don't know how to make this work. My code: <?php include '/mediainfo/MediaInfo.php'; $mediaInfo = new MediaInfo(); And I get this error: Fatal error: Class 'MediaInfo' not found in index.php...

A require statement is overwriting global variables in lua

lua,include,variable-scope,require
Consider the following two files: a.lua function x() return 1 end -- return x b.lua function x() return 2 end print( x() ) local y = require "a" print( _G.x(), y ) print( x(), y() ) When I execute my b.lua I receive the following output: 2 1 function: 0024B710...

play framework (java) : view include another view with a map

view,playframework,include,arguments
I have this view: Profile.scala.html : @(message: String) @Main("Welcome") { Welcome : @message <br> <h2>Profile</h2><br> <a href="#">Edit Profile</a><br> <a href="@routes.Application.viewEnvironments()">Your Environments</a> **@ViewEnvironment.scala.html ????? how can I include it ?** } and I want to include in it, another view (this one): ViewEnvironment.scala.html: @(map: Map[String, String]) <h2> Environments :</h2> <p><a...

Include column after grouping using datatable

r,include,data.table,subset
My goal is to calculate a group % column by zip. I created the % column by zip, but keep losing my group ('cgrp') variable. How can I keep this in my end results? My data table script is giving me the below results: zip V1 1: 12007 19.35484 2:...

undefined variable $conx in class

php,class,oop,include
I was wondering if you can explain why PHP acts this way when including files in __construct methods. class sitePosting{ private $conx; public function __construct() { include_once("".$_SERVER['DOCUMENT_ROOT']."/auth/db_conx.php"); $this->conx = $conx; } It seems that if I call another class which has this file included in its __construct, I get an...

tcpdf include external file with more tcpdf code in it?

php,include,external,tcpdf
OK....Been trying to create a pdf with alot of dynamic content and want to place some specific code in the mix based on which external file I call with include 'external-file.php'; contents of external-file.php $pdf->SetXY(6, 150); $pdf->SetFontSize(10); $pdf->Write (1, 'exampletext ', $link=''); $pdf->Write (1, $row['var1']. ' ', $link=''); $pdf->Write (1,...

C++ #include <[filename]> but #include is not a filename

c++,include
DUPLICATE: When can you omit the file extension in an #include directive? I feel a little cleverer after finding: What is the difference between #include <filename> and #include "filename"? But in my code I use #include <string>. string is not a valid filename and the angle brackets are not put...

how to use a library in c++ Qt creator

c++,qt,include,qt-creator,dicom
I downloaded a library for processing DicOM FILES . The tree of library is : |--include |-----dicom.h |-----dicomcfg.h |--lib |--------dicomsdl.lib But I do not know how to use and built-in Qt Creator . If anyone can help me I will be very grateful....

Including classes done right/wrong

php,class,oop,include
This works... classes/API.class.php abstract class API { stuff. } api.php require_once 'classes/API.class.php'; class MyAPI extends API { stuff; } $API = new MyAPI(); This doesn't work... ...but leads to a "Fatal error: Cannot redeclare class API in D:\xampp-..." classes/API.class.php abstract class API { stuff. } classes/MyAPI.class.php class MyAPI extends API...

Multi-dimensional include

android,pointers,multidimensional-array,parse.com,include
I need help with Parse queries. I have three classes which have pointers in this relation. Activity class with column "video" pointing to Video class which has another column "videoOwner" pointing to the _User class. What I want to achieve is to query the Activity class for a video and...

symfony2 - how to include a twig from a twig

php,symfony2,include,twig
Learning sympony2 and I have hit a wall and have tried numerous solution but nothing seems to work, I keep getting the Unable to find template "ScoreBoardViewerBundle.Viewer.scoreboard_keeper.html.twig" in ScoreBoardViewerBundle:Viewer:view.html.twig at line 15. Here is my twig snipped: {% if score_keeper=='sk' %} {% include 'ScoreBoardViewerBundle.Viewer.scoreboard_keeper.html.twig' with {'score_keeper' : score_keeper} %} {%...

Database Connection not Working as Include File

php,mysql,include
I want to move the my database connection info to an include file - normally, the database connects fine when I have it written out in the entire php header like this: <?php define('DB_LOCATION', 'x'); define('DB_USERNAME', 'x'); define('DB_PASS', 'x'); define('DB_NAME', 'x'); $dbc = mysqli_connect(DB_LOCATION, DB_USERNAME, DB_PASS, DB_NAME) or die('Error connecting...

write a simple c preprocessor

c,header,include,preprocessor
I am trying to write a program that immitats the functions of the C preprocessor. So my question is about expanding #include "header.h" statments. I have a FILE * pointer to the source file, so I need to scan for all the header files included in the source file, and...

why this code doesn't function [closed]

php,include
im trying to include a PHP file in my home page the php file inside a div next another div had image but it doesn't funtion and it retruns 500 server error this is the code <div> <?php if ( is_front_page() ) { <div style="padding:0 10px 0 20px; width: 80%;...

Getting a project that uses Qt working in Visual Studio 2013

c++,visual-studio,qt,include
I downloaded a Github project that uses Qt 4.8 for GUI stuff, and am now trying to open the project in VS 2013. However, I'm not sure what to do about all the #include <Qt...> statements scattered throughout the project. My first thought was to install Qt via the Qt...

Symfony include navbar html into twig template

symfony2,include,twig,bootstrap
My Symfony application has a defaultBundle which loads a default.html.twig successfully. I am trying to include the contents of a navbar.html.twig into default.html.twig. The following code is my attempt to include the navbar code: {% block body %} {% include ('navbar.html.twig') %} <!-- this generates the error --> <div class='content'>...

Does gcc search CPATH recursively?

gcc,include
On a Linux system, does gcc recursively search the path declared in CPATH environment variable, or do I need to specify every Includes sub-directory explicitly?

Include, Require a syntax error file

php,include,syntax-error,require
I would like to ask can I require/include a file that has syntax errors and if I cant, the require/include returns a value so that I know that the required/included file has syntax errors and cannot be required/included ? file.php has syntax error include('file.php') if (not file.php included because of...

Can I Include php in functions.php? - Wordpress

php,wordpress,include
I need to call custom php script when I publish new post in WP. This function works, but include not. It is not included. Can it be working or is there any other way to include php file in functios.php? function new_post_caller( $ID, $post ) { include( get_template_directory() . 'call_new_post.php?ID='.$ID.''...

How can I get the variables of a file 'Index.php' that included 'Init.php', without reincluding 'Init.php'?

php,variables,include
I am currently working on some upgrades of a small personal framework that uses MVC. The way it works currently is that when Init.php is included in a certain file, instead of looking for a variable, it gets the text content of the file (The actual source code) and just...

What is the difference between “extends” and “include” in Jade?

include,jade
With both of these commands I can use code from another file. As I see it when we use extends file.jade we can use block, to change blocks in file.jade before the compilation. But is it the only difference and am I right? Thank you.

Change the meaning of code by replacement of forward declaration with include

c++,include,forward-declaration
Google C++ Style Guide states that In extreme cases, replacing an #include with a forward declaration can silently change the meaning of code. Can you please help me to find some examples? ...

Compile failure when including files with GCC

c,osx,gcc,compilation,include
I'm trying to compile a program with gcc, but I keep getting an error that it can't find the files I've specified to include. My code (a simplified version of what I'm trying to do which highlights the issue): #include <gtk/gtk.h> int main(int argc, char *argv[]) { } I'm compiling...

Grunt: Do i need to compile HTML on each save to see the results?

html,replace,include,gruntjs,partials
While developing an HTML project i'm using include-replace grunt plugin to avoid duplication of repeated contents (e.g. header, footer, sidebar etc.). My index.html file seems something like this. <!-- @@include('header.html') --> <p>Some Content Goes Here.</p> <!-- @@include('footer.html') --> Now, the issue is, if i visit this page it shows nothing...

Include module , how does it work?

ruby-on-rails,ruby,module,include
By example : module Feature def self.included(klass) puts "#{klass} has included #{self}!" end end class Container include Feature end can you explain me how module can manipulate klass ? can't find any clear documentation about it. regards....

How to access data from other .php file in PHP?

php,include,require,data-access
I have login.php and mainpage.php files and I want to access login.php's user's data from mainpage.php. Should I use require or include? How to connect those files? require login.php; include login.php; ...

Force included pages to be included (i.e. not opened by themselves)

php,include
I am in the process of creating my own CMS system because of I am tired of Wordpress (and the hack attempts that come with it). My question is this: Is there any way to force pages in my includes directory to only be opened as included pages? Basically what...

How can I include / exclude a part of an included PHP file based on the file I am including it in?

php,function,include
The title is a bit convoluted. Let me explain better. I'm making a blog where registered users can delete and edit their posts. The posts are displayed on 2 sites - the main page, and an admin control panel page. The code for generating the posts is in a separate...

Including additional rules with flex

include,lex
I've been working on a small assembler which uses flex, however, the flex rule list is reasonably long. Ideally, I'd like to solve this by splitting the rules into several files which can be included into the primary lex file. My searching has turned up nothing of relevance which leads...

How to include CSS file in Hippo CMS?

css,resources,include,hippocms
I'm using HippoCMS 10. I did "Hello World" tutorial from official site. Now I want to include CSS file and style something. I did this: <html> <head> <link rel="stylesheet" href="<@hst.webfile path='/css/screen.css' />" type="text/css"/> </head> <body> <h1>Hello World </h1> </body> </html> But when I try to open the page (http://localhost:8080/site/) I'm...

VB.Net: Display total when check boxes are checked

vb.net,visual-studio,checkbox,include
I am making a EXP multiplier for a game, so when i key in an amount, i will tick the certain multiplier and it will multiply my EXP to display how much EXP i will earn. I want to be able to know how to include statement if i check...

Jekyll: including a post inside another post

include,markdown,jekyll,yaml-front-matter
Does Jekyll provide a way to include a post inside another post? I know that sounds a bit goofy, but I'm using it for a cooking/recipe site. Some of my recipes are made up of components, or other, smaller recipes. I'm looking for a way to include a handful of...

Include array with numeric keys fails

php,arrays,include
I have a weird problem when including a file. The included file contains a log, and the contents is (exactly) like this: <?php $fxe[20150518123308982711]='test 1'; $fxe[20150518123346582251]='test 2'; $fxe[20150518123545868736]='test 3'; The keys are made up from year+mont+day+hour+min+sec+random int I expected, after including the file, $fxe to have 3 entries: [20150518123308982711] =>...

Adding new Class file destroys program

php,object,include
so I've ran across a strange error while attempting to build my class files for my program. I have never ran into this problem with PHP before especially Object Oriented PHP. Basically the fastest way of explaining it is adding a new file makes another one not exist. I will...

C++ classes with members referencing each other and being used

c++,include
I have 2 c++ classes with members referencing each other. I am calling members of the referenced classes, so I can't use forward declarations, because I get the error "pointer to incomplete class type is not allowed" class A { B* b; void foo() { b->do_something(); } }; class B...

django how to include javascript in template

javascript,python,django,static,include
I'm starting a project and following the documentation I didn't succeed to include javascript. Here is my settings: STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, "static"), ) STATIC_ROOT = '/static/' TEMPLATE_DIRS = ( os.path.join(BASE_DIR, 'templates'), ) So I have a static folder create in my project with a javascript file....

Passing retrieved database records to a php file

php,mysql,include
system/article.php <?php $sql = "SELECT articleTitle, articleSummary, articleContent FROM articles"; $result = $dbconnect->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo $row["articleTitle"]; echo $row["articleSummary"]; echo $row["articleContent"]; } } else { echo "0 results"; } include 'template/homepage.php'; retrieves articles from the article table. I have included the homepage.php which...

Qt C++ - undefined reference to … inline QImage custom function

c++,qt,include
In my app, there are a couple of functions that I need to use in different threads at different times, and I don't want to copy-paste them everywhere. So I've made a commonfunctions.cpp and a commonfunctions.h, and included them in different places. However, one (out of many) function refuses to...

How to include an almost identical file in a separate namespace (for debugging purposes)

php,debugging,namespaces,include,namespace-organisation
I'm faced with the following PHP code problem: At the moment my PHP code is not making use of any namespaces. I have made modifications to an include file foobarinc.php so that I now have the two versions foobarinc-v1.php (the old version) and foobarinc-v2.php (the new version). The include file...

Include html page in aspx - Strange outcome with Response.WriteFile()

c#,html,asp.net,include
I need to include the same html page into several aspx pages. Following is my html page: <h1>Database Enciclopedico</h1> And I use the Response.WriteFile method to include the page in my aspx page: <div id="header"> <% Response.WriteFile("Header.html"); %> </div> The problem is that when the html page is included it...