Page 1 of 1

Php include into another php file

Posted: Wed Jan 29, 2020 8:48 pm
by lodria
Hi!

I would like to ask how can I call a bludit index.php file installed in a subdirectory?

I try these, but I can only call index.php if it is in the same directory.
What would be a good method for a subdirectory?

<?php include ('index.php'); ?> it works
<?php include ('another/index.php'); ?> it is not

I would like to integrate bludit with another page, but not with iframe.

Thanks.

Re: Php include into another php file

Posted: Wed Jan 29, 2020 9:17 pm
by Edi
It depends from the server configuration. You can try to set in the file .htaccess:

Code: Select all

# Base directory
RewriteBase /another/

Re: Php include into another php file

Posted: Thu Jan 30, 2020 7:17 pm
by lodria
Thank you very much. I haven't had time to try it yet, but it seems like a good solution.
If I can tell you.

Re: Php include into another php file

Posted: Sat Feb 01, 2020 12:49 pm
by lodria
Hi!

I tried what you recommended, but unfortunately I couldn't solve it.
I get this message: Install Bludit first.

the structure of the website is as follows:

the public_html directory has an index.php this is where the web page starts

this contains the bludit directory and bludit cms starts from the index.php file there

but if I call it in public_html with the include command

  <? Php
include ( './ bludit / index.php')
?>)

then I get the message: Install Bludit first

If I provide only one link:
https://etc.com/bludit/index.php
that's fine, but in this case I can't edit it because it doesn't open from a single page

a htacces file it looks like this:

AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>

# Enable rewrite rules
RewriteEngine on

# Base directory
RewriteBase /bludit/

# Deny direct access to the next directories
RewriteRule ^bl-content/(databases|workspaces|pages|tmp)/.*$ - [R=404,L]

# All URL process by index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [PT,L]

</IfModule>

Based on these, would you still have an idea?

Thanks

Re: Php include into another php file

Posted: Mon Feb 03, 2020 12:32 am
by Jay
You've got to declare absolute path to directory before you use relative path to file.
Read about "include" function on php.net