Jump to content
Sign in to follow this  
Farrukh

[Contribution] Header Tags Controller for Admin MS 2.2

Recommended Posts

If header_tags.php is already included by application_top.php a second require would cause error messages. As far as I know this is always circumvented by using include_once or require_once when calling code that might already have been included...

 

require_once(DIR_WS_FUNCTIONS . 'header_tags.php');

 

How do I check if header_tags.php is already included by application_top.php ? Is this what my problem is?

 

In my application_top.php include file I have the following code at the very bottom of the file...

 

// BOF: WebMakers.com Added: Header Tags Controller v1.0
require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0  
?>

 

Should I change this section of code to

 

 

// BOF: WebMakers.com Added: Header Tags Controller v1.0
require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
require_once(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0  
?>

 

 

In my product_reviews.php file I have the following code

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// BOF: WebMakers.com Changed: Header Tag Controller v1.0
// Replaced by header_tags.php
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
 <title><?php echo TITLE; ?></title>
<?php
}
// EOF: WebMakers.com Changed: Header Tag Controller v1.0
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

 

Should I do the same with this product_reviews.php file and use

 

<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// BOF: WebMakers.com Changed: Header Tag Controller v1.0
// Replaced by header_tags.php
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require_once(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
 <title><?php echo TITLE; ?></title>
<?php
}
// EOF: WebMakers.com Changed: Header Tag Controller v1.0
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

 

If so then there must be some other problem because I just tried using the require_once in the product_reviews.php file as shown above and got the following error still

 

Fatal error: Call to undefined function: tep_get_header_tag_products_desc() in /home/htdocs/users/ebonni34/ebonni34/bonafideauthentics.com/catalog/includes/header_tags.php on line 168

 

Please help I am losing my mind and going cross eyed at the same time... B)

 

Eric B


AJ2000

Share this post


Link to post
Share on other sites
How do I check if header_tags.php is already included by application_top.php ? Is this what my problem is?

 

In my application_top.php include file I have the following code at the very bottom of the file...

 

// BOF: WebMakers.com Added: Header Tags Controller v1.0
require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0 ?
?>

 

Should I change this section of code to

// BOF: WebMakers.com Added: Header Tags Controller v1.0
require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
require_once(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0 ?
?>

In my product_reviews.php file I have the following code

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// BOF: WebMakers.com Changed: Header Tag Controller v1.0
// Replaced by header_tags.php
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
?require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
?<title><?php echo TITLE; ?></title>
<?php
}
// EOF: WebMakers.com Changed: Header Tag Controller v1.0
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

 

Should I do the same with this product_reviews.php file and use

 

<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// BOF: WebMakers.com Changed: Header Tag Controller v1.0
// Replaced by header_tags.php
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
?require_once(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
?<title><?php echo TITLE; ?></title>
<?php
}
// EOF: WebMakers.com Changed: Header Tag Controller v1.0
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

 

If so then there must be some other problem because I just tried using the require_once in the product_reviews.php file as shown above and got the following error still

 

Fatal error: Call to undefined function: tep_get_header_tag_products_desc() in /home/htdocs/users/ebonni34/ebonni34/bonafideauthentics.com/catalog/includes/header_tags.php on line 168

 

Please help I am losing my mind and going cross eyed at the same time...  B)

 

Eric B

 

 

IT WORKS NOW!!!!

 

Here is what I did... I just did as JanZ suggested....

 

I changed the code in application_top.php to

 

// BOF: WebMakers.com Added: Header Tags Controller v1.0
// note the following line was changed from require to require_once
// thats because for some reason the product_reviews.php file was not working
// a forum member, JanZ, said it was because, If header_tags.php is already included 
// by application_top.php a second require would cause error messages
require_once(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0  

 

Thanks JanZ :thumbsup:

 

Sincerely,

Eric B


AJ2000

Share this post


Link to post
Share on other sites

I'm having a problem with header tags.

 

it works on the admin side but when i add the lines to application_top.php i get the red error message

 

Fatal error: Failed opening required 'includes/functions/header_tags.php' (include_path='.:/usr/share/pear') in /home/food/public_html/catalog/includes/application_top.php on line 59

 

when i remove the lines the site works.

 

i am using sts templates but with the displayoutput contrib it should work..

 

thanks guys..

 

mes

Share this post


Link to post
Share on other sites

Mes,

 

Two things:

1. Make sure the file includes/header_tags.php is there and has the correct permissions to be read by the webserver.

2. Either change the line 59 (something like: "require(DIRWS_FUNCTIONS. header_tags.php)" from the top of my head) to "include_once(etc.)" or comment it out. There might very well be no need for the include of that file in application_top.php (I don't have it and the site works fine, though I use HTC only for the products_info.php pages).

 

See what works best for you.

Share this post


Link to post
Share on other sites

How does this contribuition fit in with the various search engine optimization contributions?

 

I'm putting together two stores over the next couple of weeks and I will be using this contrib (already have in one) but I also want to make sure that search engines will be able to spider everything in the stores also.

 

What is the best route to take? One will be a computer store and the other will be jewelry store.

 

Thanx, Dave.

Share this post


Link to post
Share on other sites

Hello;

 

I would like to add in the product_info.php the Product Model and Product Name and Description. How can this be done. I have tried to use this contrb. but all what happens is I get the default that is specified in /english/header_tag.php?

 

Any suggestions?

Share this post


Link to post
Share on other sites
Hello;

 

I would like to add in the product_info.php the Product Model and Product Name and Description. How can this be done. I have tried to use this contrb. but all what happens is I get the default that is specified in /english/header_tag.php?

 

Any suggestions?

 

After you have this contribution installed, you have to login to your admin area... go to your product catalog... and click on each product.. then update the listing... you will see three new form fields for you to add the product description, keywords, and title for the header area of the product_info.php page that comes up for each of your products.

 

Eric B


AJ2000

Share this post


Link to post
Share on other sites

I have the Header Tags Controller contrib installed, but for some reason, it has stopped working. All of my pages now have the pathname as the title of the page. Viewing source shows that there are no META tags in the file.

 

Can anyone point me in the right direction?


John Skurka

Share this post


Link to post
Share on other sites

Just totally guessing here since there is no link to go on but have you looked at the actual catalog files to see if the code is still in there?

 

Jack

Share this post


Link to post
Share on other sites
Just totally guessing here since there is no link to go on but have you looked at the actual catalog files to see if the code is still in there?

 

I'm looking at it right now - I see the webmakers code in the catalog/index.php file.

 

One thing I forgot to mention is that my shop is modified pretty good, at I'm also running SimpleTemplateSystem, with which Headertags is supposed to work well with.

 

The URL: DriWash Solutions

 

Thanks Jack


John Skurka

Share this post


Link to post
Share on other sites

It has been a while since I played around with STS but when I view your source I notice it is missing standard things like doc type, title and meta tags. I doubt that STS sites normally look like that but I could be wrong. I'm thinking something has gotten deleted at some point since you should at least see the doc type and none of the contributions mess with that. I just looked at the STS template and it has this

<!--$headcontent-->

at the begining. Without that statement, the code would look just like it is on your site. So you need to verify that is present in your STS template file. If it appears OK, then replace your template file with the original (be sure to make a backup of yours) and see if the doc type appears.

 

Jack

Share this post


Link to post
Share on other sites
I just looked at the STS template and it has this
<!--$headcontent-->

at the begining.  Without that statement, the code would look just like it is on your site. 

 

Jack - YOU ARE THE MAN!

 

It WAS missing, and now everything looks to be working!

 

I'm sure this happened when I FTP'd the template file to another machine, made some mods, the FTP'd it back. That little comment tag got lost.

 

Thanks again for the quick turn around!


John Skurka

Share this post


Link to post
Share on other sites

Hi,

 

I have searched for help on this & could only find a posting by bloom which was similar, but didn't offer a solution... righty, I have been a really good boy & tried my damndist to get this sorted on my own, but now I must ask for help, please make my Christmas & answer this little stinker...

 

I get this on the New Product page, where the meta tage boxes should be:

Fatal error: Call to undefined function: tep_get_products_head_title_tag() in /home/.sites/84/site107/web/admin/categories.php on line 803

 

I've been through the documentation & can't work it out, my php is minimal (but improving!), the offending code is...

 

<?php
   }
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
        <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>          
         <tr>
           <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_PAGE_TITLE; ?></td>
           <td><table border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
               <td class="main"><?php echo tep_draw_textarea_field('products_head_title_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($products_head_title_tag[$languages[$i]['id']]) ? $products_head_title_tag[$languages[$i]['id']] : tep_get_products_head_title_tag($pInfo->products_id, $languages[$i]['id']))); ?></td>
             </tr>
           </table></td>
         </tr>

 

What have a failed to do? I followed the instructions to the T... I have also just installed the catagory description contrib, which works like a charm. But could that be interfering?

 

Many thanks guys,

 

Nick,

Share this post


Link to post
Share on other sites

Nick - that error is telling you the function cannot be found. Usually this means it was not added when you installed the contribution. Try opening admin/includes/functions/general.php and searching for

tep_get_products_head_title_tag

Is it there?

 

Jack

Share this post


Link to post
Share on other sites
Nick - that error is telling you the function cannot be found.  Usually this means it was not added when you installed the contribution.  Try opening admin/includes/functions/general.php and searching for
tep_get_products_head_title_tag

Is it there?

 

Jack

 

Thanks for the quick reply, but yes I should have said, that was what I thought the problem could have been & found it in general.php, the code looks like this:

 

  function tep_get_products_url($product_id, $language_id) {
   $product_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
   $product = tep_db_fetch_array($product_query);

-->  function tep_get_products_head_title_tag($product_id, $language_id) {
   $product_query = tep_db_query("select products_head_title_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
   $product = tep_db_fetch_array($product_query);

   return $product['products_head_title_tag'];
 }

 

The arrow isn't actually in the code, that would be a simple mistake!!

 

Does this mean the problem is going to be complex? Eek! Fingers x'ed, together we'll do this thing!

 

Many thanks,

 

Nick,

Edited by amorella

Share this post


Link to post
Share on other sites

When you added the code, you added inside another function. It should look something like this:

function tep_get_products_url($product_id, $language_id) {
  $product_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
  $product = tep_db_fetch_array($product_query);
}

function tep_get_products_head_title_tag($product_id, $language_id) {
  $product_query = tep_db_query("select products_head_title_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
  $product = tep_db_fetch_array($product_query);

  return $product['products_head_title_tag'];
}

 

Jack

Share this post


Link to post
Share on other sites

Jack, thanks ever so much, those little {}'s are really catching me out! After I fixed it I got a parsing error, but I sorted that, but now... The product name field has disappeared & I've now got 2 product description fields, one at top & one at bottom of the 3 meta tag fields. I have not modified that part of general.php, it's identical to the vanilla install, but just incase:

 

  function tep_get_products_name($product_id, $language_id = 0) {
   global $languages_id;

   if ($language_id == 0) $language_id = $languages_id;
   $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
   $product = tep_db_fetch_array($product_query);

   return $product['products_name'];
 }

 function tep_get_products_description($product_id, $language_id) {
   $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
   $product = tep_db_fetch_array($product_query);

   return $product['products_description'];
 }

 function tep_get_products_url($product_id, $language_id) {
   $product_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
   $product = tep_db_fetch_array($product_query);

   return $product['products_url'];
 }

 function tep_get_products_head_title_tag($product_id, $language_id) {
   $product_query = tep_db_query("select products_head_title_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
   $product = tep_db_fetch_array($product_query);

   return $product['products_head_title_tag'];
 }

 function tep_get_products_head_desc_tag($product_id, $language_id) {
   $product_query = tep_db_query("select products_head_desc_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
   $product = tep_db_fetch_array($product_query);

   return $product['products_head_desc_tag'];
 }

 function tep_get_products_head_keywords_tag($product_id, $language_id) {
   $product_query = tep_db_query("select products_head_keywords_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
   $product = tep_db_fetch_array($product_query);

   return $product['products_head_keywords_tag'];

 }

 

Where else could I look to find the solution? I really feel this is in my grasp for completion! Then my site will be virtually finished (!!). Anyway, it's 5am, so I better get some sleep & come straight back to this first thing tommorow.

 

Many thanks & merry Chirstmas,

 

Nick,

Share this post


Link to post
Share on other sites

It doesn't do any good to post partial code. The problem could be the one line above the code you post.

 

Jack

Share this post


Link to post
Share on other sites

Sorry my friend, I didn't want to clutter the forum & thought that'd be what was needed, so I've upped a txt file of it here:

 

general.txt

 

That way it doesn't clog up the forum with hundreds of lines of code. Your help is really appreciated Jack!

Share this post


Link to post
Share on other sites

That file looks good to me so that only leaves the admin/categories.php file assuming it is a problem with the installed HTC. Try comparing your categories.php to the one in the contribution or even temporairly replacing yours with the original to see if the fields return.

 

Jack

Share this post


Link to post
Share on other sites

When I include the header tag controller functions in my application_top.php file:

// BOF: WebMakers.com Added: Header Tags Controller v1.0
 require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
 require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

 

My site breaks (the browser show nothing but a blank page). I installed both files in my includes/functions directory. What could be the cause of this?

Edited by hoff10000

Share this post


Link to post
Share on other sites

Are you adding the code near the top or the bottom of application_top.php?

 

Jack

Share this post


Link to post
Share on other sites

I am using STS and HTC on a couple of sites and I just noticed today that something may be wrong with one of the sites. I ran a spider simulator on both sites and one site returns all the information seen by the simulator., eg. Title, Description, Keywords. My other site shows the Title but the Description and Keywords show this , "text/html; charset=".. Now when I go to view source in Internet Explorer, the Description and Keywords are in the source. Could it be the spider simulator or is it something else I need to fix?

 

Any suggestions much appreciated.

 

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×