Webmastersite.net
Register Log In

Custom Title Tags: One solution Needed
One solution needed to perfect previous post.

Comments on Custom Title Tags: One solution Needed

eharris
Member

Usergroup: Customer
Joined: Dec 15, 2005

Total Topics: 8
Total Comments: 21
eharris
Posted Dec 31, 2005 - 7:59 AM:

Paul,

In my previous post about how to customize Title Tags for categories and sub-categories I gave instructions that work quite well, but there are still a couple of needs to perfect it. I'm sure you would know the solution.

After the customization is done there are certain places that appear with no title tag where it is not possible to add one. For example, if you have a category or subcategory you need only click edit and the Title Tag field will be present at the bottom of the page form to be filled in. However, there is no such way to edit the directory Home Page. Therefore it has an empty title tag and I can't find any way to add one without a minor PHP change. There are other simular type pages with the same problem.

You have made a provision in the PHP (end.php) so that if "Page Titles Scheme:" field on the General page is empty it will default to other language tags. The problem is that it is never empty because even when the {CATCATEGORYTITLES} tag is (such as with the directory home page), it still contains the tag.

So a way must be found in the PHP to detect if the {CATCATEGORYTITLES} tag is empty or contains data. If it contains data to use the data contained, but if not to use blanket information contained in a new language tag that would need to be created. Not being much of a PHP programmer I am not sure how to write this, but assume it would to in the "end.php" file?

Your assistance is onec again appreciated.

Ed
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jan 01, 2006 - 11:31 AM:

You should use conditionals for that: scripts.webmastersite.net/w...inks/wsnmanual/articles/69

To detect the front page, IIRC <IF {TID} contains main>show</IF> works
eharris
Member

Usergroup: Customer
Joined: Dec 15, 2005

Total Topics: 8
Total Comments: 21
eharris
Posted Jan 05, 2006 - 5:47 AM:

Thanks for the direction...it was beneficial. Still, I have not found the solution.

Paul, the code you provided seems good, but there are a number of pages besides the front page that have the same condition, so the solution must globally cover all pages that can not be addressed.

I assume the code should probably go in "end.php". What I tried, but did not work, was to place the following code in end.php just before the existing code below it:


if ({CATCATEGORYTITLE} == '') $settings->titlescheme = This is a test;

EXISTING CODE:

if ($settings->titlescheme == '') $settings->titlescheme = '{LANG_NAVORIGIN}{LANG_TITLE_DIVIDER}{AREA}';
$thetitle = str_replace('{AREA}', $area, $settings->titlescheme);
if ($area == '') $thetitle = str_replace('{LANG_TITLE_DIVIDER}', '', $thetitle);
$thetitle = langreplacements($thetitle);
$totalpage = str_replace('{PAGETITLE}', $thetitle, $totalpage);
$totalpage = str_replace('{AREA}', $area, $totalpage); // define area for page title
if (strstr($totalpage, '{TOTALMEMBERS}')) $totalpage = str_replace('{TOTALMEMBERS}', $settings->totalmembers, $totalpage);

However, not knowing PHP syntax I only received error messages after a few tweeks. The goal is to detect if {CATCATEGORYTITLE} contains data or not, and if not to place either selected text or another language tag into $settings->titlescheme

Thanks,

Ed
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jan 07, 2006 - 6:10 PM:

I assume the code should probably go in "end.php".

Please read the manual entry on template conditionals, I linked you to if for a reason, and don't edit php files. The page titles are in your wrapper tempalte between <title> and </title> like any html page.
eharris
Member

Usergroup: Customer
Joined: Dec 15, 2005

Total Topics: 8
Total Comments: 21
eharris
Posted Jan 08, 2006 - 8:47 AM:

Hi Paul,

I did read that page on template conditionals throughly. The problem is that it is not possible to correct this condition from a template.

Please take a moment to read the posts from the start to refresh your memory.

The variable that affects the Title tag on the directory home page is the same variable that affects the Title tage in every page of the directory.

Further, there are no adjustments that can be made in the wrapper (header & footer), or main index templates that can correct this situation. Nor is there any change that can be made in the "Settings/General" setup menu that will correct the situation. The only possible solution is to the PHP code.

Please correct me if I'm wrong.

Currently there is a tag {CATCATEGORYTITLE} in the "Page Titles Scheme:" data entry area of the "Settings/General" entry area that correctly places custom Title Tags within every category and subcategory page of the directory. However, any page that can not be edited...whether it is the Home page of the directory, or something as simple as an Add Link page contains a blank Title tag because these areas are not represented in the "categorytitle" area of the database, and can thus never have any data to display.

Therefore a way must be found within the PHP code to test for an existing Title Tag description, whether present or not present in the MySQL database, and to place a tag description in the Title Tag area on all pages that...not being a category or subcategory...can not have a description in the database. This can be done either by the use of another created language tag, or text within the php code. But first I need the correction to work with.

A simple template adjustment won't do the job.

Can you please help me. I feel confident that a simple line or two in the end.php file will allow for the testing of this condition and a quick solution. I have been trying to get through this since 12/31. I'm sure that, with your knowledge, if you will just take an honest 10 minutes to really think this through a solution could be found very quickly and I would very much appreciate your help.

Best,

Ed
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jan 10, 2006 - 5:17 AM:

Of course you can make adjustments in the wrapper, I can't think of anything that requires PHP modification.

{TID} provides the name of the unique template being used in rendering the page, and it does that in the wrapper just as well as anywhere else. Place {TID} plain, by itself, in your wrapper. Observe what it shows when you go to particular pages. Create a conditional accordingly for the spots you want.

Please just put {TID} plain in your template and browse around so that you get an idea of what it does.

if you will just take an honest 10 minutes to really think this through a solution could be found very quickly

I'm not going to give you an unupgradable PHP hack for something that's a template modification. I provided you the exact example code you need in my January 1st, 11:31 AM post. I suggest it's more productive to do what I suggest than to protest that you don't think the script works that way... I did write it, I know how it works.

If you need it more explicit than on Jan 1st, here:
<IF {TID} contains main>
<title>Special title</title>
<OTHERWISE>
<title>{PAGETITLE}</title>
</IF>
eharris
Member

Usergroup: Customer
Joined: Dec 15, 2005

Total Topics: 8
Total Comments: 21
eharris
Posted Jan 10, 2006 - 6:02 AM:

smiling face Thank you Paul. Have you heard of that new virus that's going arount? It's called the foot-in-mouth flu. Seems I caught it a message or two ago. Thanks for the help.

Ed
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.