category title for meta in index.php ? category title for meta in index.php ?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

category title for meta in index.php ?

Started by antisa33, August 03, 2006, 03:17:37 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

antisa33

Hello
I don't find the file to modify to have the name of the category in the description meta tag ?
I think it is the index.php : when we clic on a category, and when we see the list of album, it is the index.php file.
Thanks

Joachim Müller

The function pageheader in theme.php actually writes the meta tags. It accepts the parameters $section and $meta. If you want to pass additional information to that function, check the pages that call the function and modify the code that determines the second parameter. If you want to modify index.php accordingly, search that file for the string
Quotepageheader(
You'll notices that it exists only once:pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);If you're not familiar with PHP, you'll find this piece of code a bit hard to understand - it's actually a short version of this:if ($BREADCRUMB_TEXT != '') {
    pageheader($BREADCRUMB_TEXT);
} else {
    pageheader($lang_index_php['welcome']);
}
Does this look more familiar? I hope so. You'll notice that only the first parameter ($section) of the function pageheader is being populated, which will make it easy for us to populate the second parameter.
First, let's populate it with something static: replacepageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);withif ($BREADCRUMB_TEXT != '') {
    pageheader($BREADCRUMB_TEXT, 'category list');
} else {
    pageheader($lang_index_php['welcome'], 'category list');
}
Apply this to your gallery, run coppermine in your browser and check the html output. See the difference? The <meta ...> section got populated. Depending on what you actually want, you can now populate the meta tags with dynamic content. If you're not sure what var to actually use, post what exactly is suppossed to go into the meta tags.

antisa33

Thanks Gaugau

When i replace the code with your code, i have just the word "category list" at the top on my website  ???
I forgot something ?
I just want the name of the category in meta description when i am in the page of the album list of the category, because now, there is no meta keyword and description in this page.
Thanks

Quoteif ($BREADCRUMB_TEXT != '') {
    pageheader($BREADCRUMB_TEXT, 'category list');
} else {
    pageheader($lang_index_php['welcome'], 'category list');
}

Joachim Müller

Quote from: antisa33 on August 03, 2006, 07:24:37 PM
When i replace the code with your code, i have just the word "category list" at the top on my website  ???
I forgot something ?
Yes, you failed to read my instructions carefully - I told you that the above code was a sample that would add some static content:
Quote from: GauGau on August 03, 2006, 07:14:34 AMFirst, let's populate it with something static.
As suggested, you need to replace the static words 'category list' with actual dynamic content:
Quote from: GauGau on August 03, 2006, 07:14:34 AMDepending on what you actually want, you can now populate the meta tags with dynamic content.
It's not so easy to populate the meta keywords with just the category name, as index.php will display the category overview (so you're not inside a particular category at all), or within a category there might be sub-categories. So, the question is: what is suppossed to go into the meta keywords? The current category you're in?
It seems that you're expecting a ready-to-copy-and-paste solution without looking into the code nor understanding what you do, but this is something I'm not ready to post (yet). I believe in giving users some clues, but making them to come up with their own solution, this way entertaining and educating the user. As a side effect, the user will have to give something back to the community. I want you to try to come up with a partial solution on your own: review the code before the section you've edited so far - you have all the data available inside the array $cat_data. To find out what is stored inside it, do a print_r($cat_data); somewhere near the code snippet from above - this will create some debugging output with the content of the array.
Paste the output of the temporary debug info into your posting, then comment out the code by putting double slashes in front of it like this// print_r($cat_data);