Gossamer Forum
Home : Products : Links 2.0 : Customization :

Parsing out the subcategory name

Quote Reply
Parsing out the subcategory name
OK. I need the help of some more experienced coders, here.

I want to extract the name of the subcategory so it can be used elsewhere on the page in site_html.pl.

EX:
Category: Pets/Dogs or Pets ogs

Obviously $category_name_escaped or $title tags will give me "Pets ogs". I want to create a tag that will produce just "Dogs".

This way it can be used elsewhere on the page, for example:

"Click here for $subcategory_parsed books!" could read "Click here for Dog books!"

Thanks!


------------------
Kevin D
www.greeknet.net
webmaster@greeknet.net



Quote Reply
Re: Parsing out the subcategory name In reply to
For those who are interested, I have come up with a solution that meets my needs (and maybe yours).

To Review: I wanted to be able to pull the subcategory title out of the category name to use elsewhere on the page.

I have simply added the Meta Description to my subcategory matching the title I intended to parse out. (ex: Pets/Cats ->Meta Desc=Cats)

Then I can call the meta description else where on the page to say "Click here to buy Cat books!" or whatever I want to say!

------------------
Kevin D
www.greeknet.net
webmaster@greeknet.net



Quote Reply
Re: Parsing out the subcategory name In reply to
Good idea, Kevin. Smile

I trierd to figure out the same thing for a while and finally gave up. This is a good work around.

Phoenix
Quote Reply
Re: Parsing out the subcategory name In reply to
Kevin or Phoenix,

I have asked the same question before. However, I am unable to understand what Kevin is saying above. Could you please explain?

Thanks
Quote Reply
Re: Parsing out the subcategory name In reply to
Socrates,

When you add a category, one of the fields you can fill in (optional) is "Meta Description". Normally this would be used to build a META tag in the page header to be used by search engine spiders when they index your site.

Kevin's suggestion is to use that field to put in a "short name" or alternate name for your category, so that if you category is Books/Animals/Cats, you'd fill in the Meta description field as just "Cats."

And then rather than call the category name from the templates or from site_html.pl, you'd just call the Meta Description field instead. It's just a work-around, using one field instead of the other.

Hope this helps
Phoenix
Quote Reply
Re: Parsing out the subcategory name In reply to
For those who have emailed, here is an example of the tag on a page. (remember you must define the meta description as your "short" title)


Code:
<a href="buythis.com">
Click here for $meta_name music!
</a>

Just an example.

------------------
Kevin D
www.greeknet.net
webmaster@greeknet.net



Quote Reply
Re: Parsing out the subcategory name In reply to
Thank for your replies. Whenever you find a simple soultion for a problem you thought was complex, you just have make sure you heard it right.