Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can i add <head></head> tags to header.php?


Trout69

Recommended Posts

Hi All,

 

I am currently working through content rating on my site to try and prevent children from accessing it...i need to place specific code in the <head> tags of my site, but not sure what the best way is to do it? My initial thought was to add this to the header.php file as it is used on every page. but there aren't any <head> tags in the file? Can i add them without impacting on the layout, or should i add them else where?

 

You suggestions would be most appreciated.

 

Best Regards

 

Donna :thumbsup:

Link to comment
Share on other sites

There's no easy way to do it on a stock oscommerce shop. You need to add an includes statement in the <head> of each page of your site and then create a file to include that has the code you want to add. You could just add the code directly to each file but if you ever need to change it, it would require a lot more work. If you install the Header Tags contribution, and possible cDynamic Meta Tags too, the code would be in place for you to do this. Plus, your site would have an important addition.

 

Jack

Support Links:

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

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The <head> tags are contained within all of the pages within the main catalog folder. Edit each file to place the content that you desire or better use an include statement as jack_mcs suggested.

 

The easiest way to do this would be to use an editor that has a Replace in Files feature that supports regular expressions. Otherwise you will have to edit each file manually.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

There's no easy way to do it on a stock oscommerce shop. You need to add an includes statement in the <head> of each page of your site and then create a file to include that has the code you want to add. You could just add the code directly to each file but if you ever need to change it, it would require a lot more work. If you install the Header Tags contribution, and possible cDynamic Meta Tags too, the code would be in place for you to do this. Plus, your site would have an important addition.

 

Jack

 

Hi Jack,

 

I'm just looking into this now, as i am adding a contrbution that requires me to edit all the files...starting with account.php i am going to add:

 

include('includes/header_info.php');

 

I'm using dreamweaver so all is colour coded, if i add this after:

 

require('includes/application_top.php');

 

Then the code looks ok, but if i add it in the <head> tags as suggested it is not...any ideas?

 

Also, do you know what editor i can use to add this in quickly rather than edit every file manually?

 

Best Regards

 

Donna

Link to comment
Share on other sites

Thanks both...not as simple as i would have hoped...but i'll give it a go...

 

Best Regards

 

Donna

You can find the head tags in the index.php file in the catalog directory this is where i put my meta tags.

It works with no problems.

Link to comment
Share on other sites

When you placed the:

include('includes/header_info.php');

line in the <head> block are you also encapsulating it with php blocks?

 

For example,

<?php include('includes/header_info.php'); ?>

 

In regards to making the edits easy, I believe that Dreamweaver's Replace in Files function allows for regular expressions. If that is the case, then you could search for:

</head>

 

and replace it with:

<?php include('includes/header_info.php'); ?>\r\n</head>

 

Make sure you have a backup of all of the files *before* doing the above as it is late and I am tired and I may have mistyped.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

  • 2 weeks later...
When you placed the:

include('includes/header_info.php');

line in the <head> block are you also encapsulating it with php blocks?

 

For example,

<?php include('includes/header_info.php'); ?>

 

In regards to making the edits easy, I believe that Dreamweaver's Replace in Files function allows for regular expressions. If that is the case, then you could search for:

</head>

 

and replace it with:

<?php include('includes/header_info.php'); ?>\r\n</head>

 

Make sure you have a backup of all of the files *before* doing the above as it is late and I am tired and I may have mistyped.

 

Thanks Daemonj, i'll look into it, i was kinda hoping there would be some sort of batch file software which would do the lot...lol...we can but hope i guess....

 

I'm hopefully gonna get round to this later today, and no worries about backing up...i had an 'experience' so only work on an offline version of my store these days....lol

 

Best Regards

 

Donna

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...