Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I use include...


gareth123456

Recommended Posts

I need to pull a .php page that currently sits at root (ie in www.mysite.com/events.php) so that the content is sat in an info box.

 

Currently I am achieving this by using an iframe (like a frame but using javascript) but this creates problems with the content changing to https when is should be http) but I want to changes this and add it using an include statement.

 

 

I know that code like "include(DIR_WS_BOXES . 'manufacturers.php');" is used in other parts of oscommerce to call pages from elsewhere to boxes, but how would I call a file that sites in my root using similar code? Do I simply use include('events.php'); or do I need to declare where is is along the lines of DIR_WS_BOXES ??

 

Any ideas?

Link to comment
Share on other sites

Yes. Did you try it?

 

The include path PHP should be looking at will be the current directory FIRST. Thus, if events.php is in the same directory as the file you are including it with, it will be found.

 

I can not get it to work. This is the code that I put in my infobox to try to call the file that is in my website root directory:

 

 

$info_box_contents[] = array('text' =>
'. include(calendar_content.php).
');

 

When I upload the code my info box contains the text ". include(calendar_content.php)."

 

Any ideas?

Link to comment
Share on other sites

I can not get it to work. This is the code that I put in my infobox to try to call the file that is in my website root directory:

$info_box_contents[] = array('text' =>
'. include(calendar_content.php).
');

 

When I upload the code my info box contains the text ". include(calendar_content.php)."

 

Any ideas?

 

try

 

$info_box_contents[] = array('text' =>
include(calendar_content.php));

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

try

 

$info_box_contents[] = array('text' =>
include(calendar_content.php));

 

Tried it, I get this error message:

 

Warning: main(calendar_contentphp): failed to open stream: No such file or directory

 

My code uses calendar_content.php .... looks like it dosnt like the .

Link to comment
Share on other sites

Tried it, I get this error message:

 

Warning: main(calendar_contentphp): failed to open stream: No such file or directory

 

My code uses calendar_content.php .... looks like it dosnt like the .

 

ok read through this thread ... we did a pretty similar thing a while ago but I didn't really remember ...

 

TG a search for my user name, file+content+include+box got me this thread :thumbsup:

 

http://www.oscommerce.com/forums/index.php?sho...ox+file+content

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

ok read through this thread ... we did a pretty similar thing a while ago but I didn't really remember ...

 

TG a search for my user name, file+content+include+box got me this thread :thumbsup:

 

http://www.oscommerce.com/forums/index.php?sho...ox+file+content

 

 

Thanks for the link. I tried something similar but got database connection errors - my calander_content file looks at the database you see.

 

I trieds to define the file name in filenames.php - define('FILENAME_CALENDAR_CONTENT', 'calendar_content.php');

 

Then call FILENAME_CALENDAR_CONTENT instead of calander_content.php, but I still got an error - again relating to my database connection!

Link to comment
Share on other sites

Looks like iframes come will all sorts of https and http issues see this blog

 

Looks like there workround to prevent https and http problems but I dont know how!!

 

Calling all ifames experts!!!

 

here is the iframes code that I use to call my file.....

 

<iframe name="calendar" id="calendar" align="center" valign="top" marginwidth="0" marginheight="0"
src=calendar_content.php?_month=&_year= frameborder="0" height="200" width="100%" scrolling=no>
Sorry, you browser does not support iframes.</iframe>

 

Has anyone got a fix ??

Link to comment
Share on other sites

I think that I have got this fixed. If i tried to use the 'include' statement, I got all sorts of database problems..

 

So I have stuck with the iframe and used an absolute path so my iframe code becomes:

 

<iframe name="calendar" id="calendar" align="center" valign="top" marginwidth="0" marginheight="0"
src=http://www.mysite.com/calendar_content.php?_month=&_year= frameborder="0" height="200" width="100%" scrolling=no>
Sorry, you browser does not support iframes.</iframe>

 

Seems to stop the problems when i am in nonssl mode and if i do get problems under ssl, i'll code out the box so it wont show when users are logged in and making a purchase.

 

For anyone else using the Events Manager contribution - if you have similar problems you may need to add absolute paths in events_calendar.php too eg. <a href="http://www.mysite.co.uk/' in order to stop it defaulting to https.

 

Monkia - thanks for your input on this.

 

Thanks

 

Gareth

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...