Php include into another php file

Post Reply
lodria
Master Bludit
Posts: 151
Joined: Wed Jan 29, 2020 8:32 pm
Has thanked: 27 times
Been thanked: 10 times

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: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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

Code: Select all

# Base directory
RewriteBase /another/
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
lodria
Master Bludit
Posts: 151
Joined: Wed Jan 29, 2020 8:32 pm
Has thanked: 27 times
Been thanked: 10 times

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
Master Bludit
Posts: 151
Joined: Wed Jan 29, 2020 8:32 pm
Has thanked: 27 times
Been thanked: 10 times

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: 133
Joined: Mon Feb 11, 2019 8:41 pm

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