zero-perfoliate
zero-perfoliate

Author Topic: include problem  (Read 256 times)

Offline pentahexamine

  • New PHP Members
  • Posts: 3
  • Karma: +0/-0
include problem
« on: August 08, 2010, 02:20:50 PM »
I have a site that uses php includes for header, footer and most importantly menu as that changes constantly.  I have a second site that hosts a shopping cart.  I would like to put those includes on the shopping cart site i.e.
Code: [Select]
<?php include("http://homerart.org/includes/menu.inc"?>.  This doesn't seem to work.  How can I do this?
Thanks

Offline cwarcarblue11

  • PHP Problem Solvers
  • *****
  • Posts: 112
  • Karma: +1/-0
    • C2C Technology
Re: include problem
« Reply #1 on: August 08, 2010, 09:54:05 PM »
I have a site that uses php includes for header, footer and most importantly menu as that changes constantly.  I have a second site that hosts a shopping cart.  I would like to put those includes on the shopping cart site i.e.
Code: [Select]
<?php include("http://homerart.org/includes/menu.inc"?>.  This doesn't seem to work.  How can I do this?
Thanks

Add a semi-colon like this:
Code: [Select]
<?php include("http://homerart.org/includes/menu.inc"); ?>[/code

Offline pentahexamine

  • New PHP Members
  • Posts: 3
  • Karma: +0/-0
Re: include problem
« Reply #2 on: August 09, 2010, 12:55:06 PM »
Nope.  include() apparently doesn't work with URLs.  I'm looking at possibly fopen() or get_file_contents().  Any ideas?

Offline cwarcarblue11

  • PHP Problem Solvers
  • *****
  • Posts: 112
  • Karma: +1/-0
    • C2C Technology
Re: include problem
« Reply #3 on: August 09, 2010, 01:12:35 PM »
Oh I am sorry I overlooked that ... Yes, fopen() would work. I think this will help you.

Offline pentahexamine

  • New PHP Members
  • Posts: 3
  • Karma: +0/-0
Re: include problem
« Reply #4 on: August 09, 2010, 05:11:13 PM »
Yes!  That did it.  Thanks for the help.  I'm a happy newbie.