|
|
First of all thank you for answering.
I know that I can put the / just before the file name.
The idea was to avoid that: there are thousands of places with the file name but only a few with the path.
I'd like to know why do this happens. I've not seen this behavior documented anywhere.
Thanks again.
|
|
|
|
|
Have you included ALL your code?
This seems impossible if there is no other code between the two lines.
|
|
|
|
|
Why do you ask if I've included ALL the code? I've included some files in order not to repeat code. There are plenty of situations in which I'm using this.
Do I'm missing something?
Here we go...
I know it seems incredible but it is what it happens...
I'm doing something like:
$path = DOC_ROOT.'/';
echo $path; Here it works well.
but if I'm doing something like:
$path = DOC_ROOT.'/';
$path2 = $path.'folderX'
$path3 = $path.'folderY'
include ($path.file1.php);
include ($path2.file9.php);
here it fails in each include and if I'm trying to get echoed the result it also fails.
As I'm using the paths to include code, I've misunderstood at the beginning... my fault...
[www.tamelectromecanica.com] Robots, CNC and PLC machines for grinding and polishing.
modified on Saturday, March 19, 2011 9:19 AM
|
|
|
|
|
don't you mean
include ($path.'file1.php');
include ($path2.'file9.php');
|
|
|
|
|
Yes, I'm at home now without access to the code (using pseudocode here).
|
|
|
|
|
another suggestion: if you know or can calculate your folder depth (currently requested script's distance from the web root) try this:
$sDepth='../../';
require_once($sDepth.'file1.php');
|
|
|
|
|
Your code works fine for me (XAMPP 1.6.6a; PHP 5.2.5).
Look again Monday!
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
<?php
$path_root = $_SERVER['DOCUMENT_ROOT'].'/';
echo $path_root;
include($path_root.'aaa.php');
include($path_root.'bbb.php');
?>
* Error: : "Warning: include(C:/Program Files/EasyPHP-5.3.5.0/wwwbbb.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.5.0\www\index.php on line 9
It seems to me that, for any unknown reason the last '/' is getting removed automatically after using it inside an include clause.
|
|
|
|
|
Three comments:
1.
that looks like a bug then, in your PHP system.
2.
why do you feel a need to specify an explicit path in an include? I never do that, I use relative paths. Wouldn't
include('aaa.php');
include('bbb.php');
work well?
3.
please try again with a backslash in $path_root.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: that looks like a bug then, in your PHP system
It had no sense to me... Strange behavior.
Luc Pattyn wrote: why do you feel a need to specify an explicit path in an include?
Probably this is again a bug then... I've tried to use relative paths like '../aaa.php' and so on, but the problem here is that I'm using some files from different locations and those files seem to inherit (somehow) the original path... then the relative paths change depending on the file that is including the file that includes another file... Using the doc_root helps me avoiding this problem...
Luc Pattyn wrote: please try again with a backslash in $path_root.
Done it already... it don't wants to work...
Thank you for your answer!
|
|
|
|
|
you're welcome.
FYI: I typically use:
require_once("includes/somename.php");
i.e. my pages are at the top level of the web site, my dependencies one level down. Never had a problem with it.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
$path_root is a global variable, so maybe something in the 'aaa.php' include (or another file included by that) is modifying it.
|
|
|
|
|
Nice suggestion, I tried this the first thing... searched for all the $path_root variables in the web site in order to find any inconsistence...
The only thing it can happen here is that the include clause is removing the last / in the file path.
I works once, it never works again.
|
|
|
|
|
PHP has two ways for specifying strings.
single quotes ''
double quotes ""
$car = 'Holden';
$sq = 'My car is a $car'; //My car is a $car
$dq = "My car is a $car"; //My car is a Holden
With double quotes the variable is inserted.
If you are using an array or want to seperate a variable in double quotes use braces.
$array['tv_show'] = 'American Idol';
$br = "{$array['tv_show']} is terrible but {$car}'s are awesome";
for the example above use "{$_SERVER['DOCUMENT_ROOT']}/FILE.php";
It may be that you are using windows and the interpreter could be swapping a '/' for '\'.
|
|
|
|
|
Hi,
just wondering if we can create a library(dll type) in php netbeans like we can in .NET.
it's just that i have set of data class and business logic classes and i want to keep them in a seperate library and include that in different projects.
Other question is if it's good way to have library in php or is it better to include each class as and when required ??
Thanks
|
|
|
|
|
|
كيفية الطباعة من mySQL مع حفظ الرئس الصفحة
|
|
|
|
|
Please post your question(s) in English only.
I must get a clever new signature for 2011.
|
|
|
|
|
Hello !
i'm running redhat enterprise 5.5 on a computer with some other operating systems.I need to hide the partitions of other OS from places in linux for all users including root.What can i do ?
Thank you in advance !
|
|
|
|
|
that's a tough one... what other OS are you working with? one possible way would be to place those partitions on a second physical drive then just don't mount that drive in linux. that'll keep ppl from seeing it, but they can always mount the drive by hand if they know its there.
|
|
|
|
|
This may be useful: http://www.justlinux.com/forum/showthread.php?t=149828[^]
Also, many programs that format/create partitions allow you to hide partitions.
See if you can crack this: b749f6c269a746243debc6488046e33f So far, no one seems to have cracked this!
The unofficial awesome history of Code Project's Bob!
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
Hi I want have several button or link in my form that everyone do something ,
So my form have several lesson’s name in front of everyone is button that if you click on it show you the program of that lesson how can I do this ?I want to show another form that show the program’s lesson
But I can’t access the variable please guide me
|
|
|
|
|
I am trying to integrate php scripting into my application using the windows ScriptControl object. VBScript and JScript are working well on a broad variety of platforms including Vista,XP, server 2008r2/2003/2000.
Can not get php scripting to work. This wsf file pops-up a 'hello world' window, but wscript crashes.
<job id="test">
<script language="PHPScript">
$WScript->Echo("Hello World!");
</script>
</job>
and I get this:
Faulting application WScript.exe, version 5.7.0.18005, time stamp 0x49e01e60, faulting module php5ts.dll, version 5.3.5.0, time stamp 0x4d24d421, exception code 0xc0000005, fault offset 0x000915f5, process id 0xa0c, application start time 0x01cbdc073a834083.
Here's what I have done.
- I installed php 5.3.5
- copied php5activescript.dll (5.2.7.7) in the php folder
- regsvr32 php5activescript.dll (successfully)
- found and changed registry key [HKEY_CLASSES_ROOT\CLSID\{CF108A38-59A9-468A-AF45-1368D7855DAE}\InprocServer32] to point to php5activescript.dll not regsvr32.exe. (from http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/d7fb1088-5896-48db-9db8-43739feceaee)
Any thoughts?
|
|
|
|
|
Hi,
I am interested in knowing more about this design methodlogy to program an application.
Do not know how u call this structure but it is use to design an application. I am sure it is a popular design methodology since it helps project development. I hope someone recognizes to steer me in the right direction to learn more. tx
Hooks
if ($h->pageName == 'login') { $h->pageTitle = 'Welcome login to your Account'
$h->currentUser->loggedIn
----
Comments
<?php
/**
* name: Hello World
* description: Sample Plugin Tutorial
* version: 0.1
* folder: hello
* class: hello
* hooks: ....
A newbie might see above as comment. But these comment are use. For example name being Hello World for that is the plugin folder name. Class actually usage of the word Hello is a required syntax for that plugin Hello (please note class hello in the comment area). tx
Class hello
{
public function theme_index_top($h)
....
--------
Template, Plugin that can redefine some core code, etc.
Any info appreciated on this design methodology. tx
|
|
|
|