Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: category title for meta in index.php ?  (Read 3665 times)

0 Members and 1 Guest are viewing this topic.

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
category title for meta in index.php ?
« on: August 03, 2006, 03:17:37 am »

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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: category title for meta in index.php ?
« Reply #1 on: August 03, 2006, 07:14:34 am »

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
Quote
pageheader(
You'll notices that it exists only once:
Code: [Select]
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:
Code: [Select]
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: replace
Code: [Select]
pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);with
Code: [Select]
if ($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.
Logged

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: category title for meta in index.php ?
« Reply #2 on: August 03, 2006, 07:24:37 pm »

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

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: category title for meta in index.php ?
« Reply #3 on: August 04, 2006, 08:17:49 am »

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:
First, let's populate it with something static.
As suggested, you need to replace the static words 'category list' with actual dynamic content:
Depending 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
Code: [Select]
// print_r($cat_data);
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.