Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header tags in template


Piemol

Recommended Posts

Hey all,

 

Lately I was curious about the templating system in version 2.3.x, and was wondering why header tags are separate modules.

 

Is it wrong to just do in product_info.php (this is one of the many examples I can think of):

$oscTemplate->setTitle($product_info['products_name']. ' | ' . $oscTemplate->getTitle());

 

Instead of letting a custom module do this:

 

$product_info_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);

$oscTemplate->setTitle($product_info['products_name'] . ', ' . $oscTemplate->getTitle());

 

 

I totally don't see the point of the extra queries and work of the header tags module, if you have all the info and functions you need in product_info.php allready.

If you want to save queries, you can use global $product_info in the extra header tags module, but that's questionable too.

 

 

Can someone explain me the pros and cons of my approach or the default one ?

 

Thanks in advance,

 

Leo

Link to comment
Share on other sites

The module system in osC 2.3.x was designed to make it easier for store owners to make changes. You can easily add to the stock Header Tags modules with other modules with different functionality. For example, a module that allows you to set a different title than the on-page title, or one that adds text to the existing module's title. This is much more difficult to do if you have to edit code. Modularity was one of the most popular requests for new features in the 2.2x era.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...