Jump to content
Jack_mcs

Header Tags SEO

Recommended Posts

This is invalid code. That function return FALSE and must be tested with !==. Changing it to != will not provide the correct results.. Beyond that, the code posted by Gary was from several years ago and should not be needed if you have the latest version of Header Tags installed.

Hi Jack. Thanks for the response.... but I did quite a bit of debugging on this with echo statements and such, and at least on my server, which is IIS and PHP 5.3 I believe, and for me (having also USU5), I was able to see definitively that the problem was that when strripos would (validly) retrun zero (for example, when testing www.mydomain.com/index.php), the !== test will evaluate TRUE (i.e. zero is equivalent in value to FALSE but not of the same var type as boolean FALSE, so "!==" evaluates "true" in this case), but that then causes the true-part of the ternary if construct to execute, which is "basename(substr($_SERVER['PHP_SELF'], 0, $pos))", but in this case $pos is zero, and so your substring() would return a null string, i.e. starting at position 0 for 0 length.... so, $page as I said is an empty null string, so the subsequent switch evaluating $page fails to execute the desired functionality.

 

After mulling over this and with numerous debug echo's and what not, I came to the belief that what your ternary if was meaning to do was to execute the "true part" of the ternary only if we had a valid, non-zero value for $pos from the prior strripos() - i.e. NOT 0 (meaning "/" found in first position of search string so strripos() returns 0) and NOT FALSE (meaning "/" not found at all so strripos() returns bool FALSE). So, the way to do that, and to therefore insure that the "false part" of the ternary IF is executed if $pos is either zero or FALSE, is to use the "!=", since that will leave out the identity test - i.e. type check - out of the test. In other words, not worrying about matching var type, zero and FALSE will be equivalent. So, now with the conditional check using "!=", $pos equal to zero causes the condition check of the ternary IF to evaluate as "false", and thus execute the correct "false part" code of the ternary, i.e. the "basename($_SERVER['PHP_SELF'])", which then correctly provides a page name value for $page, and then the following code in the switch statement works as expected.

 

So, this change on my system makes HT SEO work as I expect it to, otherwise, the ternary IF statement never returns a page name and so none of the desired $page evaluation code in the switch statement ever gets executed. Maybe it has something to do with USU5 and that I have that in standard mode instead of re-write mode, but I don't think so, as I can re-create this from a page such as simply www.mydomain.com/about_us.php, but in any event, as I've described above, this is a real issue on my system and this "fix" appears to me to be valid, indeed the proof is in the pudding as the tag values for the about_us page etc. stored in the header tags db will never get loaded if $page never returns the current name of the current page, obviously.... if you have a better, more valid, more correct "fix", please let me know..... even though I've been a software developer for over 20 years, I am admittedly not an expert in PHP, so I may have stumbled onto something that on the surface seems to "fix" my problem, but are your saying that may be an illusion? Thanks for your further consideration on this.... the more I get into issues and discussions like this, the more it helps me learn about the PHP world. Thanks!

Share this post


Link to post
Share on other sites

...Beyond that, the code posted by Gary was from several years ago and should not be needed if you have the latest version of Header Tags installed.

 

Hi Jack, I went back and double checked my original header_tags.php file that came as part of your 3.2.8 package that I downloaded earlier this year, and the "old" code is indeed in there that Gary references in his post, and for which he relayed your recommended solution.... so I followed the instructions you all had there in that clubosc post, and it did indeed then allow my HT SEO 3.2.8 and USU5 configuration to begin working together just fine, other than when I started to use Page Control for pages like my about_us.php, which is when I realized the "!==" vs. "!==" issue.... but as I mentioned, I was able to at least seemingly "fix" that by changing the "!==" to "!=" in yours/Gary's posted code fix.... will be waiting for your further insights on that as mentioned above. Thanks!

Share this post


Link to post
Share on other sites

I found some time ago this post at http://www.clubosc.com/seourls5-htcseo3.html which explains the fix Jack provided to make HT SEO and USU5 work. I use URI mode = standard (because I'm on a windoze server - long story) and it works great. If you scroll down to near the bottom of the comments on the above-referenced clubosc post, you'll see a question posted from Gurdeep dated May 2, 2012.

I found that page as well in my searching, but it made mine worse. And as Jack mentioned a couple posts ago, it is no longer needed.

I eventually got rewrite to work in USU5, by resetting the cache. Then as mentioned in several places, both mods now work on the same shop. For me it is all good as I had chemos rewrite add on from years ago so my new store will have the exact same urls as the current store.

 

thanks to both contributors,

 

Tim

Share this post


Link to post
Share on other sites

Hi Jack,

 

After updating to 3.2.7 I have an error in my categories box but only when you click on a manufacturer in the manufacturers box.

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/****/public_html/includes/boxes/categories.php on line 36
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/****/public_html/includes/boxes/categories.php on line 43

 

Those error codes are repeated several times before it starts to display the actual categories. Once again, this only shows up if you click on a manufacturer in the manufacturers box.

Edited by blaine109

Share this post


Link to post
Share on other sites

Hi Jack,

 

After updating to 3.2.7 I have an error in my categories box but only when you click on a manufacturer in the manufacturers box.

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/****/public_html/includes/boxes/categories.php on line 36
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/****/public_html/includes/boxes/categories.php on line 43

 

Those error codes are repeated several times before it starts to display the actual categories. Once again, this only shows up if you click on a manufacturer in the manufacturers box.

The latest version is 3.2.8. Please use that.

Share this post


Link to post
Share on other sites

I am using 3.2.8, I just didn't have the issues till I did the big upgrade to 3.2.7.

 

The lines that the error is point to on line 36 and 43 of categories.php is:

   if ( ($id) && (in_array($counter, $id)) ) {

Edited by blaine109

Share this post


Link to post
Share on other sites

I am using 3.2.8, I just didn't have the issues till I did the big upgrade to 3.2.7.

 

The lines that the error is point to on line 36 and 43 of categories.php is:

if ( ($id) && (in_array($counter, $id)) ) {

You didn't say you were using 3.2.8. 3.2.7 was broken so I can't comment on any error to do with it. The error you mention though is not part of Header Tags since it doesn't change the category box. If the error didn't occur until after this installation, then you either made a mistake in the installation or there is some conflict with the code in your category box.

Share this post


Link to post
Share on other sites

I am using 3.2.8, I just didn't have the issues till I did the big upgrade to 3.2.7.

 

Surely this is a backward step as 3.2.8 came after 3.2.7


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

I figured out my issue. Somehow my install of 2.2RC2a, which is a Fantastico install, had an old MS1 file for includes/boxes/categories.php. I replaced it with a fresh copy with a real 2.2RC2a copy of the file and all is working now.

Share this post


Link to post
Share on other sites

hi jack

 

i've installed version 3.2.8 and get the following error (from admin-header tags seo-test):

 

1146 - Table 'XXXXXX.TABLE_HEADERTAGS' doesn't exist

 

select page_name from TABLE_HEADERTAGS where page_name like 'index.php' and language_id = '1' LIMIT 1

 

i had a look in includes/database_tables.php and the modifications are made, in phpmyadmin and the tables are also created.

can you please tell me what to do to get this great contrib working?

 

thx in advance

andrea

Share this post


Link to post
Share on other sites

Have you added the code into the includes/database_tables.php


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

@@14steve14

 

yes, i added the code in includes/database_tables.php and also in admin/includes/database_table.php

also i controlled if the tables exist in my database with phpmyadmin and the tables were created

Share this post


Link to post
Share on other sites

The error is saying it can't find the definition. If you've made that change, be sure it is actually on the server (not just on your computer). That is the only thing it can be, assuming your shop is structured as a standard oscommerce shop.

Share this post


Link to post
Share on other sites

hmmm, strange, now it's working, but i didn't touch anything, and i'm sure i've putted my pages to server before reporting to this forum.

anyway, many thx for help and this great contrib

 

regards

andrea

Share this post


Link to post
Share on other sites

Jack,

 

When I was having difficulty upgrading this past weekend and made all the changes then reverted them and made them again I ended up running the db update twice. So now in Configuration->HeaderTagsSEO I have all the options listed out twice.

 

Please advise the best course of action to removing the duplicates as each duplicate does have a separate cID.

 

Thanks,

Blaine

Share this post


Link to post
Share on other sites

Jack,

 

When I was having difficulty upgrading this past weekend and made all the changes then reverted them and made them again I ended up running the db update twice. So now in Configuration->HeaderTagsSEO I have all the options listed out twice.

 

Please advise the best course of action to removing the duplicates as each duplicate does have a separate cID.

You will need to edit the configuration table directly and delete the extras. Search for HEADER_TAGS_ and all of them should show, making it easier to see which to delete.

Share this post


Link to post
Share on other sites

You will need to edit the configuration table directly and delete the extras. Search for HEADER_TAGS_ and all of them should show, making it easier to see which to delete.

Jack,

 

Does it matter which duplicate I delete?

Share this post


Link to post
Share on other sites

Jack,

 

I've looked and didn't see one but was wondering if there was a special character conversion tool for this contribution. I know you have one in your SEO URLS contribution. I sell items that are measured in inches and I use the quotation mark (") in my tags and titles but that seems to prematurely close my keywords, meta, etc. tags. If not, is there somewhere I can hardcode that in to make this conversion: "=>inch

 

Thanks,

Blaine

Share this post


Link to post
Share on other sites

Jack,

 

I've looked and didn't see one but was wondering if there was a special character conversion tool for this contribution. I know you have one in your SEO URLS contribution. I sell items that are measured in inches and I use the quotation mark (") in my tags and titles but that seems to prematurely close my keywords, meta, etc. tags. If not, is there somewhere I can hardcode that in to make this conversion: "=>inch

No, there's nothing like that in the code. You're correct. about it being trucated when used. Google interprets the quote mark as end of string so if you include a " in a title or meta tag, google only takes characters up to that point. The best thing is to just use the word, as you mentioned. But you would have to do that manually in the product edit page. Or, you could edit the includes/header_tags.php file and do a replace right before the resutls are returned.

Share this post


Link to post
Share on other sites

No, there's nothing like that in the code. You're correct. about it being trucated when used. Google interprets the quote mark as end of string so if you include a " in a title or meta tag, google only takes characters up to that point. The best thing is to just use the word, as you mentioned. But you would have to do that manually in the product edit page. Or, you could edit the includes/header_tags.php file and do a replace right before the resutls are returned.

Jack,

 

I'm not fluent enough in PHP to follow all that is going on in the includes/header_tags.php file. I've tried to figure it but was not successful at figuring it out. I may need to enlist your help on it.

 

I will make a suggestion for you to consider. Since the data that your script is putting out is in HTML you may consider cleaning all the arrays by converting any special character with HTML significance (htmlspecialcharacters) so that it doesn't interfere with the HTML syntax. It would still be nice to have a special characters conversion like you have in your SEO URLs contribution.

Share this post


Link to post
Share on other sites

In need of some help. I have had the header tags installed for awhile but the feature to make unique tags isnt working everything is just the default tag any ideas what could be wrong?

Share this post


Link to post
Share on other sites

I have installed Header Tags latest version 3.2.8 in an Oscommerce shop 2.3.3. Everything seems OK, I don't get any error messages. However in admin I get no special header tag box so I cannot fill in header tags for index page for example. I can fill in header tags for categories and products so that works.

 

What have I done wrong if I don't get any header tag box in admin? Someting I have forgotten?

 

Note: I had some problems in admin/manufacturers.php file. It does not look the same as in the installation description. Maybe that file has changed in osc 2.3.3.

Share this post


Link to post
Share on other sites

Sorry there was a small misstake in admin/includes/colums_left.php. Now I can see the headet tags box.

 

However there where some strange things in admin/manufacturers.php file when I made the installation. Has anyone else with osc 2.3.3 had the same experience?

Share this post


Link to post
Share on other sites

In need of some help. I have had the header tags installed for awhile but the feature to make unique tags isnt working everything is just the default tag any ideas what could be wrong?

That's usually due to the checkbox settings in Page Control. There are examples and images in the package to help with that.

Share this post


Link to post
Share on other sites

Okay, need some help.

 

I was given a new site to look at today and it was coded by someone who did not know what they were doing.

 

It still uses the Header Tags SEO v3.2.5 and the Currently Viewing shows the item title, like it should but the Title of the page is showing a URL. Any suggestions on what the hell is wrong?

 

I did download the v3.2.5 full install contrib and going line by line but almost everything matches. Making me go crazy.

 

Oh and there is no backups SMH!

I do have the same problem, but using V3.2.8

Please help us.

 

Many regards, Mario

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

×