Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

upgrade RC2a -> V2.3 template & Meta tags


Juto

Recommended Posts

After pooking into "catalog/includes/template_top" I could see that the meta tags are set once and for all pages.

If I am correct this will limit the usefulness of metatags.

 

On some pages you might want to have:

 

<META NAME="robots" CONTENT="noindex,nofollow,nosnippet,noodp,noarchive,noimageindex">

 

On others:

 

<META NAME="robots" CONTENT="nosnippet,noimageindex" >

 

As I understand it, this is not possible with "catalog/includes/template_top"

 

Correct me if I am wrong.

Link to comment
Share on other sites

After pooking into "catalog/includes/template_top" I could see that the meta tags are set once and for all pages.

If I am correct this will limit the usefulness of metatags.

 

On some pages you might want to have:

 

<META NAME="robots" CONTENT="noindex,nofollow,nosnippet,noodp,noarchive,noimageindex">

 

On others:

 

<META NAME="robots" CONTENT="nosnippet,noimageindex" >

 

As I understand it, this is not possible with "catalog/includes/template_top"

 

Correct me if I am wrong.

 

 

It is possible like this: in the file you want extra stuff (this is what I have in product_info.php only)

 

$head_tag='';

$head_tag .= '

<link rel="stylesheet" type="text/css" href="ext/jquery/fancybox/jquery.fancybox-1.3.4.css" />

<script type="text/javascript" src="ext/jquery/bxGallery/jquery.bxGallery.1.1.min.js"></script>

<script type="text/javascript" src="ext/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"></script>' . "\n";

$oscTemplate->addBlock( $head_tag, 'header_tags' );

require(DIR_WS_INCLUDES . 'template_top.php');

Link to comment
Share on other sites

Hi! Thanks a lot! :) It seems to me that I need to reconsider upgrading My shop.

I am still a little hesitant as I can't see the benefit of the template system.

In the upgrade I would have prefered to have had "Template Layout and Modular Header Tags" as separate upgrades.

Giving me a chance to understand, and perhaps skip Header Tags, since I have KISS meta tags installed.

 

Thanks for your answer...

 

Sara

Link to comment
Share on other sites

Hi! Thanks a lot! :) It seems to me that I need to reconsider upgrading My shop.

I am still a little hesitant as I can't see the benefit of the template system.

In the upgrade I would have prefered to have had "Template Layout and Modular Header Tags" as separate upgrades.

Giving me a chance to understand, and perhaps skip Header Tags, since I have KISS meta tags installed.

 

Thanks for your answer...

 

Sara

 

I think it depends what you mean by "upgrading". The new system is far far better when it comes to designing a NEW template as, amongst other things, gone are the days of having to modify all root files to make a basic template change .. now the core template exists in only two files template_top and bottom.

 

Hopefully this will also instigate the death of that aweful STS thing. ( apologies to the devs who worked hard on it, I just hate it )

 

2.3.1 is not a reason to "dump the old shop and start anew" instead you can simply apply the updates relating to 2.3.1 for reasons of security etc. and still retain your old shop.

Link to comment
Share on other sites

Hi! Thanks a lot! :) It seems to me that I need to reconsider upgrading My shop.

I am still a little hesitant as I can't see the benefit of the template system.

In the upgrade I would have prefered to have had "Template Layout and Modular Header Tags" as separate upgrades.

Giving me a chance to understand, and perhaps skip Header Tags, since I have KISS meta tags installed.

 

Thanks for your answer...

 

Sara

 

I also have KISSMT installed. With 2.3.1 the header tags can be turned on and off in admin. I use KISSMT with the osC google code, ie I have chosen which tags to use in admin. That is the idea of being modular

Link to comment
Share on other sites

Hi Robert and thank you so much for your answer.

 

So, is this correct?

 

$head_tag='';

$head_tag .= '

<link rel="icon" href="favicon.ico" type="image/x-icon">

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

<link rel="stylesheet" type="text/css" href="ext/jquery/fancybox/jquery.fancybox-1.3.4.css" />

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

<META NAME="description" content="'. echo TEXT_CONTENT_DESCRIPTION. '"> <=======================note the dots

<META NAME="robots" content="noindex,nofollow,nosnippet,noodp,noarchive,noimageindex">

<script type="text/javascript" src="jquery142/jquery-1.4.2.min.js"></script>' . "\n";

//

$oscTemplate->addBlock( $head_tag, 'header_tags' );

include_once DIR_WS_MODULES . 'kiss_meta_tags/kiss_meta_tags.php'; <============================include the wonderful KISS MT

require(DIR_WS_INCLUDES . 'template_top.php');

Link to comment
Share on other sites

Hi Robert and thank you so much for your answer.

 

So, is this correct?

 

When the html is parsed by PHP you can't/don't need to use the echo construct .. the following is correct ( except why the content description? KissMT provides this ): -

 

$head_tag = '
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="ext/jquery/fancybox/jquery.fancybox-1.3.4.css" />
<link rel="stylesheet" type="text/css" href="liquidcorners/liquidcorners.css" media="screen">
<META NAME="description" content="' . TEXT_CONTENT_DESCRIPTION . '">
<META NAME="robots" content="noindex,nofollow,nosnippet,noodp,noarchive,noimageindex">
<script type="text/javascript" src="jquery142/jquery-1.4.2.min.js"></script>' . "\n";
$oscTemplate->addBlock( $head_tag, 'header_tags' );
include_once DIR_WS_MODULES . 'kiss_meta_tags/kiss_meta_tags.php';
require DIR_WS_INCLUDES . 'template_top.php';

 

Also you didn't need the $head_tag='';

Link to comment
Share on other sites

Hello Robert, sorry for my late reply. I didn't get a e-mail notification :(

Anyhow I have followed your advice to the dot and edited all files.

 

Just out of curiousity: will the desciption meta tag disturb the KISS MT?

 

Thank you so much for your advice, I really am grateful for your professionality and your fantastic contributions!

Kindest

Sara

Link to comment
Share on other sites

Hello Robert, sorry for my late reply. I didn't get a e-mail notification :(

Anyhow I have followed your advice to the dot and edited all files.

 

Just out of curiousity: will the desciption meta tag disturb the KISS MT?

 

Thank you so much for your advice, I really am grateful for your professionality and your fantastic contributions!

Kindest

Sara

 

KISSMT provides the description tag. If you use another one there will be 2

Link to comment
Share on other sites

  • 5 months later...

Here is something for both of you:

 

The file osc_template.php differs between the upgrade version and the v2.3.1 For the upgrade the code is:

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 class oscTemplate {
   var $_title;
   var $_header_tags = array();

   function oscTemplate() {
     $this->_title = TITLE;
   }

   function setTitle($title) {
     $this->_title = $title;
   }

   function getTitle() {
     return $this->_title;
   }

   function addHeaderTag($tag) {
     $this->_header_tags[] = $tag;
   }

   function getHeaderTags() {
     if (!empty($this->_header_tags)) {
       return implode("\n", $this->_header_tags);
     }
   }

   function buildHeaderTags() {
     global $language;

     if ( defined('MODULE_HEADER_TAGS_INSTALLED') && tep_not_null(MODULE_HEADER_TAGS_INSTALLED) ) {
       $htm_array = explode(';', MODULE_HEADER_TAGS_INSTALLED);

       foreach ( $htm_array as $htm ) {
         $class = substr($htm, 0, strrpos($htm, '.'));

         if ( !class_exists($class) ) {
           include(DIR_WS_LANGUAGES . $language . '/modules/header_tags/' . $htm);
           include(DIR_WS_MODULES . 'header_tags/' . $class . '.php');
         }

         $ht = new $class();

         if ( $ht->isEnabled() ) {
           $ht->execute();
         }
       }
     }
   }
 }
?>

 

The v2.3.1 have

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 class oscTemplate {
   var $_title;
   var $_blocks = array();
   var $_grid_container_width = 24;
   var $_grid_content_width = 16;
   var $_grid_column_width = 4;

   function oscTemplate() {
     $this->_title = TITLE;
   }

   function setGridContainerWidth($width) {
     $this->_grid_container_width = $width;
   }

   function getGridContainerWidth() {
     return $this->_grid_container_width;
   }

   function setGridContentWidth($width) {
     $this->_grid_content_width = $width;
   }

   function getGridContentWidth() {
     return $this->_grid_content_width;
   }

   function setGridColumnWidth($width) {
     $this->_grid_column_width = $width;
   }

   function getGridColumnWidth() {
     return $this->_grid_column_width;
   }

   function setTitle($title) {
     $this->_title = $title;
   }

   function getTitle() {
     return $this->_title;
   }

   function addBlock($block, $group) {
     $this->_blocks[$group][] = $block;
   }

   function hasBlocks($group) {
     return (isset($this->_blocks[$group]) && !empty($this->_blocks[$group]));
   }

   function getBlocks($group) {
     if ($this->hasBlocks($group)) {
       return implode("\n", $this->_blocks[$group]);
     }
   }

   function buildBlocks() {
     global $language;

     if ( defined('TEMPLATE_BLOCK_GROUPS') && tep_not_null(TEMPLATE_BLOCK_GROUPS) ) {
       $tbgroups_array = explode(';', TEMPLATE_BLOCK_GROUPS);

       foreach ($tbgroups_array as $group) {
         $module_key = 'MODULE_' . strtoupper($group) . '_INSTALLED';

         if ( defined($module_key) && tep_not_null(constant($module_key)) ) {
           $modules_array = explode(';', constant($module_key));

           foreach ( $modules_array as $module ) {
             $class = substr($module, 0, strrpos($module, '.'));

             if ( !class_exists($class) ) {
               include(DIR_WS_LANGUAGES . $language . '/modules/' . $group . '/' . $module);
               include(DIR_WS_MODULES . $group . '/' . $class . '.php');
             }

             $mb = new $class();

             if ( $mb->isEnabled() ) {
               $mb->execute();
             }
           }
         }
       }
     }
   }
 }
?>

 

So, for the upgrade version it's not possible to use

 

$oscTemplate->addBlock($head_tag, 'header_tags' );

 

The one to use is

 

$oscTemplate->addHeaderTag($head_tag);

 

Further it is not possible to have

 

include_once DIR_WS_MODULES . 'kiss_meta_tags/kiss_meta_tags.php';

 

If this in template_top is in use:

 

<?php echo $oscTemplate->getHeaderTags(); ?>

 

If I get it right, if I use kiss meta tags, then I can't use the header_tags modules or?

 

If so, then away goes, for example ht_opensearch

 

 

I have added the "missing" block functions, just for testing... :) (So far the front end is working).

 

It seems to me that a more skilled person like you guys should set the record strait :)

 

For now I will do the testing to see the impact of my added of the "missing" block functions

 

Any advice is appreciated

 

Sara

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...