hi
my drupal site is http://test.example.com
i have a template.php file in my theme folder
define('SITE_ROOT','http://example.com/abcd/');
i am using this SITE_ROOT for my custom functions
but echoing SITE_ROOT gives http://test.example.com
how is this happening.
plz help
Look for define('SITE_ROOT' in the whole drupal source code; it's probably defined somewhere in index.php or the config file.
thank you guys
i find the solution . i defined the SITE_ROOT in settings.php file and everything worked fine.
Related
I have a file structure that looks like this (unimportant files left out):
Testserver
-file.php
PHP
-functions.php
Administration
-index.php
Now when I try to call require_once('../PHP/functions.php'); inside the "index.php" it doesn't work and I don't understand why. Anyone an idea what the problem could be?
This works fine:
require_once('../file.php');
first thanks for all the answers, I found the bug now:
inside the functions.php I require another file and the path to that file wasn't correct when I called it from index.php
So I had to change the path inside functions.php not inside index.php.
Still thanks to everyone for the other suggestions :)
Do you get an PHP error, and if what does it say?
Check for lowercase/uppercase problems
The following should work correctly:
require_once('../PHP/functions.php');
Check your privileges on the folder and try:
require_once('../PHP/functions.php')
You have a Folder Structure Like so:
Testserver
-file.php
PHP
-functions.php
Administration
-index.php
And then, you are inside of index.php trying to Access the File functions.php, which lives inside of the Directory PHP. Then you need to go up one Directory from the current directory of the index.php File (ie. The Administration Directory) [meaning that you get up to Testserver Folder from theAdministration Folder] and then drill down to the PHP Directory. In code this would mean:
<?php
require_once __DIR__ . "/../PHP/functions.php";
Hope this does it for you.
Cheers & Good Luck....
I have decided to swap my standard html navigation for a php include, i have a multi deirectory site so have had to include the file using ../ to move up the directories where applicable.
When using the navigation from my root folder it works fine but when i then try and use the same navigation in a subdirectory file my file paths get added onto the end of the current path for example.
http://example.co.uk/catagoryOne/catagoryTwo/index.php
Becomes:
http://example.co.uk/catagoryOne/catagoryTwo/catagoryOne/catagoryThree/index.php
Where i need it to be:
http://example.co.uk/catagoryOne/catagoryThree/index.php
Could anyone tell me why this is happening?
Many thanks in advance
P.S. Apologies if this is not clear please let me know if anything requires further clarification.
Wouldn't this be solved via .htaccess as it is to do with url?
Read more on .htaccess here
To fix this problem i used
<li><a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/catagoryOne/catagoryThree/index.php"></li>
within navigation.php where applicable.
How to call css or js file from
/app
/webroot
/bootstrap
/bootstrap.css
if i added
echo $this->Html->css('bootstrap');
code in view/Locale/default.ctp its working fine .. but bootstrap.css file not taking from bootstrap folder .
If i copied bootstrap.css in webroot/css folder its working fine ..
I am fresher for cakephp . Can anyone help me to resolve issue
The path that you provide in $this->Html->css() is the path of webroot, If you have a sub-folder under webroot, and the css file is in the sub-folder,you have to specify the sub-folder name, like this:
$this->Html->css('bootstrap/bootstrap');
use this hope this Help
$this->Html->css('/bootstrap/bootstrap');
I'm trying to create an OpenCart 1.5.1.3 module. The issue I'm having is with including a custom php script.
When I do this in the controller:
include('module/simple_html_dom.php');
or
include('simple_html_dom.php');
I'm presented with the following error:
Notice: Error: Could not load language module/simple_html_dom! in D:\xampp\htdocs\store\system\library\language.php on line 26
I suspect there's a simple explanation, but just can't work it out.
The reason is that you're still in theory calling from the index.php file, so need to either use a relative path from that, or use a defined variable, which you can find in the config.php file that have all the relevant paths OpenCart uses
I've found a way to include the file I wanted. I'm not sure it's the proper way of doing this but I used the following code - with OpenCart having such little documentation it's not easy to debug and/or develop for it.
require_once(DIR_SYSTEM . 'simple_html_dom.php');
DIR_SYSTEM is OpenCart's /system folder, so I placed my simple_html_dom.php file in there and voila, it worked.
I have the same problem in opencart. i have to install file i have something like
<?php include 'i_header.tpl';?>
I replace it with
<?php include (DIR_TEMPLATE. '/module/---your module name ---/i_header.tpl');?>
and it works. You can chose the correct path name which under the config file.
ROOT/config.php
ROOT/admin/config.php
I hope this helps.
Please help!
My directory structure is this:
my_application
my_application/index.php
my_application/images
my_application/phpcode/my_script.php
I have this code in my_script.php
<?php
if(file_exists('../images)){
// do something
}
?>
It works in wamp perfectly!!!
But when I upload it to my server (hostgator), it doesn't work.
In my server I do not upload it to root folder, but to a subfolder.
rootfolder/folder1/folder2/my_application
From what I understand, .. is in reference to the root path, not the current file.
How can I reference the current's file parent's folder images?
Sorry for my English. Please help! I'm stuck on this one.
You can simpli use dirname($SCRIPT_FILENAME) to reference the direcotry of your current script.
Have a look at PHP Constant and PHP Reserved Variable :)
Hope this help