I've been trying to use the php includes code instead using iframe, but I'm having some issues. I have 2 php platforms (Joomla & Shopping Cart) that I need to connect together somehow. Basically I need to "include" the shopping cart template within a Joomla Template (so basically like iframe). I was told I should just use the php includes command to do this, but I can't seem to get it to work even though it looks really easy to code in.

This the command I am using

<?php include "Shopping-cart-url.html"; ?>

Please help. I can't seem to understand why it isn't working.

Thanks.

Dani AI

Generated

A few clarifications and practical steps that build on what , and suggested.

Including a remote URL with PHP behaves very differently from including a local filesystem file. Enabling allow_url_fopen lets functions like file_get_contents() open HTTP URLs, but it does not enable include/require of HTTP URLs — that is controlled by allow_url_include, which is usually disabled for good security reasons. Also remember that including an HTTP URL will pull the remote server’s rendered output (HTML), not the cart’s PHP source or its internal state.

Concrete troubleshooting checklist

  • Confirm whether you’re trying to include a local file or an HTTP URL. If the cart is on the same server, prefer an absolute filesystem path (or Joomla path constants such as JPATH_SITE) instead of an HTTP URL.
  • Turn on error reporting or check PHP/Apache error logs to see warnings/fatals; as said, the error message will point you to the problem.
  • If the page halts at the include, inspect the included file for exit/die/redirects or session/header logic that can stop output. Also verify filesystem permissions and ownership.

Better long-term approaches (safer and more robust)

  • If both apps live on the same host, integrate at the application level: either install the cart as a Joomla component/module or include the cart’s bootstrap in a controlled way so both systems share the environment.
  • If the cart is remote, fetch its rendered HTML server-to-server (cURL is recommended), rewrite relative URLs or add a base URL, and forward cookies/sessions as needed — but be aware the remote cart’s PHP session won’t automatically tie into Joomla’s.
  • Avoid enabling allow_url_include on production systems; it’s a security risk. If a seamless user/session experience is required, look for vendor-provided Joomla integrations or use a server-side proxy (Apache/Nginx) rather than remote PHP includes.

These steps should help isolate whether the problem is configuration, path/permissions, or the included application itself.

Recommended Answers

All 5 Replies

Hi, the line of code you have pasted seems to be correct.
Maybe your Shopping-cart-url.html is not where php is looking for it, or
maybe the problem is somewhere else in your code.
I can only suggest that you look at the error message (if there are any) for some idea as to where the problem lies

are you trying to include ?
you must have allow_url_fopen enabled to do that

Thanks. How do I "allow fopen"

All your help is appreciated.

php.ini

find it, examine it, change the flag
this codescrap will tell you much

<?php phpinfo(); ?>

you may have to query your host to find where php.ini is, or where you may put it if it 'isnt' many hosts have a master version of php.ini not accessible to individual accounts, but permit a local one for each hosted site

Your stand-alone shopping cart may not be includable, check with the cart provider most have multiple language versions of the cart that are includable

Thanks again for your help. I was able to enable the allow_url_fopen in the php.ini . I then tried the code above the grab the php file I needed within a another php file, but alas I did have any luck. As a matter of fact the page stopped loading at the code I entered

<?php
include("File.php"); ?>

Hopefully we can figure this out.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.