Php include into another php file

Post Reply
lodria
Jr. Bludit
Posts: 3
Joined: Wed Jan 29, 2020 8:32 pm

Wed Jan 29, 2020 8:48 pm

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.
User avatar
Edi
Site Admin
Posts: 1711
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Wed Jan 29, 2020 9:17 pm

It depends from the server configuration. You can try to set in the file .htaccess:

Code: Select all

# Base directory
RewriteBase /another/
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
lodria
Jr. Bludit
Posts: 3
Joined: Wed Jan 29, 2020 8:32 pm

Thu Jan 30, 2020 7:17 pm

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.
lodria
Jr. Bludit
Posts: 3
Joined: Wed Jan 29, 2020 8:32 pm

Sat Feb 01, 2020 12:49 pm

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
User avatar
Jay
Master Bludit
Posts: 82
Joined: Mon Feb 11, 2019 8:41 pm

Mon Feb 03, 2020 12:32 am

You've got to declare absolute path to directory before you use relative path to file.
Read about "include" function on php.net
Post Reply