Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a PHP file help


J B

Recommended Posts

Hi all- I'm struggling to make something work, or even find out if it's possible. Basically, I have a .php file setup with the code/text/links/images I want to display throughout my OSC pages, but I am not sure how to implement it. Is this something I can do with a basic includes setup? I've tried a few different ways to implement it with no luck.

 

I searched and didn't come up with much, so any help is great appreciated.

 

Thanks!!

Link to comment
Share on other sites

JB,

 

Typically if you want to add a page (about us, FAQ, Other) you would use an existing file pair as a template. For example, to add a FAQ page, you could copy the root [catalog] /shipping.php file and change all occurrences of 'shipping' to FAQ, then upload the edited file naming it FAQ.PHP

 

Then in the /includes/languages/english directory, edit the shipping.php language file and then upload it as FAQ.PHP. Then include the FAQ.PHP file in the root [catalog]/filenames.php list.

 

The last step would be to add the file link where you want it on your site.

 

It is important to work within the current OSC structure or you will end up with a mess.

 

 

Chris

Link to comment
Share on other sites

JB,

 

Typically if you want to add a page (about us, FAQ, Other) you would use an existing file pair as a template. For example, to add a FAQ page, you could copy the root [catalog] /shipping.php file and change all occurrences of 'shipping' to FAQ, then upload the edited file naming it FAQ.PHP

 

Then in the /includes/languages/english directory, edit the shipping.php language file and then upload it as FAQ.PHP. Then include the FAQ.PHP file in the root [catalog]/filenames.php list.

 

The last step would be to add the file link where you want it on your site.

 

It is important to work within the current OSC structure or you will end up with a mess.

 

 

Chris

Thanks for your replies. Basically what I am after is simply displaying small clickable icons and rotating javascript file on my OSC section of the website. I have the file all setup and being accessed in all other areas of my website, but since OSC is kinda like it's own sub-section, it is not yet implemented there. I don't know if that better clarifys.

 

So, to Chris, if I read correctly, I should create a new file modeled after an exsisting .php file (does it have to be a page or can it be something like footer.php since I am looking to include images/links and not a whole page) ? Then simply implement it into the OSC structure...correct?

Link to comment
Share on other sites

Sounds more like you want either a box containing your code in the column left or column right or in the header or footer rather than a page.

 

I would think the code would be aded to one of the files in /includes directory.

 

HTH

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Sounds more like you want either a box containing your code in the column left or column right or in the header or footer rather than a page.

 

I would think the code would be aded to one of the files in /includes directory.

 

HTH

 

G

I think that's what it'll come down to. I ideally wanted that code to be sourced from an external file, as that external file will be updated regularly. So rather than update that file AND the code inside my OSC, Id rather just update one to keep it current and correct....

Link to comment
Share on other sites

I would make a file called ie ticker.php and place it into catalog/includes. In this file I put all code I want, with all html formatting I need.

 

From there on I can "include" my new file like this

<?php include(DIR_WS_INCLUDES . 'ticker.php'); ?>

 

Remember, that the file that gets included, doesn't need any <head></head> information

Link to comment
Share on other sites

I would make a file called ie ticker.php and place it into catalog/includes. In this file I put all code I want, with all html formatting I need.

 

From there on I can "include" my new file like this

<?php include(DIR_WS_INCLUDES . 'ticker.php'); ?>

 

Remember, that the file that gets included, doesn't need any <head></head> information

Very simple and straight forward, I'll definitely try this.

 

Now, maybe this is a dumb question, but let's say for example I have a "ticker.php" file that's not located in the root OSC area, can I still access it via

<?php include(DIR_WS_INCLUDES . '/otherfolder/updates/ticker.php'); ?>

---for example?

Link to comment
Share on other sites

<?php include(DIR_WS_INCLUDES . '/otherfolder/updates/ticker.php'); ?>

---for example?

 

Not exactly like this, because the directory is already given with DIR_WS_INCLUDES as this was defined in configure.php, and thats in most cases /includes/

 

In general you can include anything to anywhere, just be careful if including external files with php functions, not to execute any harmful code. Read more about include, but maybe you are also interested in readfile

 

EDIT: read about include also here -> include

Link to comment
Share on other sites

Not exactly like this, because the directory is already given with DIR_WS_INCLUDES as this was defined in configure.php, and thats in most cases /includes/

 

In general you can include anything to anywhere, just be careful if including external files with php functions, not to execute any harmful code. Read more about include, but maybe you are also interested in readfile

 

EDIT: read about include also here -> include

Thanks for the links and info

 

I tried

<? include('http://www.mysite.com/directory/file.php'); ?>

with no luck. The DIR_WS_INCLUDES you prodived works for the most part so I may stick with that until I can revisit using just the one remote file for the info.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...