Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tip for putting pages in a subdirectory


Guest

Recommended Posts

To put pages into a subdirectory such as http://www.yourdomain.com/catalog/faq/privacy.php is quite easy. All changes are in bold;

 

This is actually another quality Yesudo tip. :thumbsup: Thanks Em.

 

Reasons to do this might be because you have a large number of pages and it is easier to keep them organized if they are in directories or you can use this to add keywords for SE's by using those keywords in the directory name such as http://yourdomain.com/keyword/optimized-seo-page.php. Don't forget to put deep page links in your footer to help SE's find the pages.

 

This example also links the language file to the subdirectory also (includes/languages/faq/privacy.php) and added the second breadcrumb.

 

 

 

<?php

/*

$Id: privacy.php,v 1.22 2003/06/05 23:26:23 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

chdir('/home/***/public_html/');

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/faq/' . FILENAME_PRIVACY);

 

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_FAQ));

$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link('faq/' . FILENAME_PRIVACY));

 

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo TEXT_INFORMATION; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_FAQ) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Be careful with this since it is difficult to get pages indexed by the SE's once they get past the third level.

 

Jack

 

 

Hi Jack, :)

 

I agree it is not for everyone but it might have its place for some people.

Link to comment
Share on other sites

I just wanted to clarify what I said. I think this is a good idea but my thoguht was that if you have a deep level page with no direct link to it, then the SE's may not find it, at least not right away. If there are direct links to it from the footer, left or right columns, then there shouldn't be a problem. This is clearly stated in the post and I somehow missed that. I apologize for the confusion this may have caused.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 3 weeks later...

UPDATE:

 

PROBLEM: When on a subdirectory page and the currency is changed it looks for the file name without the subdirectory. So if on /faq/myfaqpage.php and the currency is swithed it will revert to /myfaqpage.php and produce a 404 page not found error for the customer.

 

FIX: (by the way this is another quality yesudo fix)

 

In includes\boxes\currencies.php

 

Change:

 

	$info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'),

 

To:

 

	$info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link($PHP_SELF, '', $request_type, false), 'get'),

Link to comment
Share on other sites

  • 2 weeks later...

The use of chdir as mentioned above by Java Roasters, from a logic perspective, should also work for pages outside of the store e.g.

 

Main site in root

 

Store in /catalog directory

 

Allowing the session to be retained and also the use of all the functionality of osCommerce. So you could have the bestsellers or what's new box showing somewhere in the main site i.e.

 

<?php

 chdir('/home/***/public_html/catalog/');

 require('includes/application_top.php');

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title><?php echo TITLE ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
 <table border="0" width="125" cellspacing="0" cellpadding="0" align="center">
<tr>
  <td><?php include(DIR_WS_BOXES . 'best_sellers.php'); ?></td>
</tr>
 </table>
</body>
</html>

Your online success is Paramount.

Link to comment
Share on other sites

  • 4 weeks later...

wow, I think I finally found my answer......will this keep the pages inside the "WHO'S ONLINE" page? specifically the LAST URL section.

 

my site is like this:

 

product pages are

 

root/products/productname/product1.php

root/products/productname/product2.php

Link to comment
Share on other sites

As long as application_top.php is included then it should work as that is where the whos_online tracking is instigated.

 

hmmm....well the page(s) in question are not only outside the engine, but they are just plain old PHP/HTML pages......no calling to application_top

 

I am using the load external sessions mod which has this at the top of the page:

 

include_once('../../includes/configure.php');

 

include_once('../../includes/database_tables.php');

 

include_once('../../sessions.class.php');

 

this keeps the session id so that when the user goes back to the main osc pages his/her cart is still there.

 

any suggestions?

Link to comment
Share on other sites

I added:

 

chdir('/home/***/public_html/');

require('includes/application_top.php');

 

and it only worked ONCE. It recorded the page in the LAST URL section of WHO'S ONLINE and then when went to another page and came back it was gone......then it never came back again

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

Wow this topic was hard to find...

 

Oke sorry for the bump. I fixed the problem (shouldn't echo before requires...)

 

This really IS the coolest thing, subdirectory pages, awesome tip!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...