Gossamer Forum
Home : Products : DBMan : Customization :

how do I pull $rec_variables into title tag of view_success page for search engine friendly page titles?

Quote Reply
how do I pull $rec_variables into title tag of view_success page for search engine friendly page titles?
I would like to include a few of the $rec variables in each page title when you view an individual record.
<title>$rec{'manufacturer'} $rec{'model'}</title>

However, I don't know how to pull the $rec variables from the database in the sub html_view_success section - they are by default ignored there unlike in the html_record section.

How can I use the $rec variables in the page title section of sub html_view_success ?

Many thanks in advance.
Quote Reply
Re: [Jeff-C] how do I pull $rec_variables into title tag of view_success page for search engine friendly page titles? In reply to
This thread should provide some ideas:

Thread: http://gossamer-threads.com/p/56647
Topic: defining titles...
mart - June 19, 1999

and:

Thread: http://gossamer-threads.com/p/57591
Subject: Different Title for Each Record
Posted by: blakex - 29-Jul-99

If the thread references aren't no long valid search by the thread subject in all DBMan forums.

The threads are also available in the FAQ under the category "Viewing"

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] how do I pull $rec_variables into title tag of view_success page for search engine friendly page titles? In reply to
Thanks Lois... but...

That was the solution I was using before, to feed dbman a page title as a combination of fields fed to the script via. the url called:

if ($in{'title'}) {
$html_title = "Records for $in{'title'}";
}

elsif ($in{'model'}) {
$html_title = "$in{'manufacturer'} $in{'model'}";
}
else {
$html_title = "Search results";
}


etc.

However, the problem is that now I want to allow the use of shorter URL's, so folks can view their record as simply domain.com/goto/123 where 123 is the ID of their record. Modrewrite changes /goto/123 to db.cgi?db=default&uid=default&view_records=1&nh=1&mh=1&ID=123

This makes accessing their page much faster when typing a direct URL and much simpler to include a short link on their page / email (no wrapping problems), etc.

However, since all the script gets from the short URL is the ID, there are no url-fed fields to use to makeup the title.

So what I really need to figure out is how to show ID=123 and pull information from the database, not the url, to create the page title.

In the thread referenced, JPDeni says "It will require a lot of rearranging of your html.pl file, since the results are returned after the <head> tags are printed." Can it be done only rearranging the html.pl or would I also have to do major modifications to the actual db.cgi script so the database fields can be used inthe html_view_success section and not only the html_record section? I'm not sure I know enough perl to accomplish this on my own, so I was hoping someone else might have done it already to guide me along the way...