Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem adding a new page


Guest

Recommended Posts

How can I add a new page to say the "Information.php" Or the Information block on the default install. I have added the page name into the application_top.php, and have copied the privacy.php page to use as a guide & changed it to reflect the new page name locations.php

 

But I can't seen to have it display properly when I try to add it into the

 

$info_box_contents = array();

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_LOCATIONS) . '">' . BOX_INFORMATION_LOCATIONS . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

Link to comment
Share on other sites

You need to add a define to your language file

 

define('BOX_INFORMATION_LOCATIONS', 'Locations');

 

So you need to create a language file called locations.php just save as the privacy.php as you did the other file. includes/laguages/english/your_new_file.php

 

Just think of your file being all new. You have to add it to application_top.php, as you have. And create a new language file too.

Steve

-------------------------

Link to comment
Share on other sites

with some trial and error I was able to add links to mine using simple HTML in the script like this:

$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .

'<a href="links.html">' . Links . '</a><br>' .

'<a href="art.html">' . Art_Department . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .

'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

 

Now the one thing I can tell you is that if you use any spaces in the <a href>link name</a> that the box will not view, as you see in my code I had to use an underscore between the words art_department. Anyone know how to get around this??

Good things happen to good people!

Link to comment
Share on other sites

Yup, don't do it that way. :)

 

You need to do FOUR things when you add a new page:

 

1. Create your new language file for your new page.

in this example the new file is includes/languages/english/locations.php

(or simply copy an existing language file such as includes/languages/english/privacy.php rename it to locations.php then edit it's contents accordingly - easiest way to not get confused) You need to do this for every language (/english/ - /espanol/ - /german/ - etc.) you intend to support/offer on your site

 

2. Edit application_top.php to define the url of your new page.

define('FILENAME_LOCATIONS', 'locations.php');

 

3. Edit your language file eg: english.php to include the description for the link to your new page:

define('BOX_INFORMATION_LOCATIONS', 'Locations');

 

4. Edit includes/boxes/whatever-box-you-are-adding-the-link-to

-- Usually this would be information.php if you are adding a new link under the default 4 in "Information" - this code snippit works if this link is inbetween the existing links - if it's the last link in the list you need to remove the trailing . (and make sure the above links have the trailing .)

'<a href="' . tep_href_link(FILENAME_LOCATIONS, '', 'NONSSL') . '">' . BOX_INFORMATION_LOCATIONS . '</a><br>' .

 

 

 

If you look at those four files you will get a clear understanding of how adding a new page works in osc.

 

Hope this was useful to you, or anyone else confused about adding a new page to OSC. :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...