forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: infamousnomie on April 16, 2004, 07:58:59 am

Title: meta, keywords
Post by: infamousnomie on April 16, 2004, 07:58:59 am
i saw in the theme file that it says in the header {meta} or similar to that i wonder does how to put key words there or does coppermine does itself?? i add the images in using batch add so i dont put any description or keywords do i have to put the keywords for the website manually??
Title: meta, keywords
Post by: Joachim Müller on April 16, 2004, 08:37:49 am
next time, please post only one question per thread!
Keywords in meta-tags will be in cpg1.3.0 (which is still beta). To add them for cpg1.2.x, edit displayimage.php and find
Code: [Select]
$comments = html_comments($CURRENT_PIC_DATA['pid']);and add after it
Code: [Select]
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\">"; }
Find
Code: [Select]
pageheader($album_name . '/' . $picture_title, '', false);and replace with
Code: [Select]
pageheader($album_name . '/' . $picture_title, $meta_keywords, false);
Haven't tested, but this should be it...
You can add/modify keywords using the "Edit pics" button next to each album when in admin mode.

GauGau
Title: Re: meta, keywords
Post by: arne on July 12, 2004, 08:57:17 pm
Hi this works fine for the displayed picture, but not for what I was looking for...

I want all keywords displayed on the index.php as well.
Is that possible by any chance?

http://ww1.australien.shellmaster.de/galerie/index.php
Title: Re: meta, keywords
Post by: Casper on July 12, 2004, 10:05:27 pm
There was a hack/mod posted to do what you want, but it was many months ago, and I have no idea who by.
A search of the mods board should find it eventually.
Title: Re: meta, keywords
Post by: Casper on July 12, 2004, 11:17:14 pm
OK, done it as you want, keywords on front page.

You do this by adding the following code to your anycontent.php, and then adding anycontent to the 'contents of main page' in config;

Code: [Select]
// Select all keywords
starttable("100%", "Keywords used in this gallery", 1);

$result = mysql_query("select keywords from {$CONFIG['TABLE_PICTURES']}");
if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap']);

// Find unique keywords
$keywords_array = array();

while (list($keywords) = mysql_fetch_row($result)) {
        $array = explode(" ",$keywords);

        foreach($array as $word)
        {
        if (!in_array($word,$keywords_array)) $keywords_array[] = $word;
       }
}

sort($keywords_array);
$count = count($keywords_array);

// Result to table
echo "<tr><td>" ;
for ($i = 0; $i < $count; $i++) {
  echo "<a href=\"thumbnails.php?album=search&search=$keywords_array[$i]\">$keywords_array[$i]</a> " ;

}
echo "</td></tr>" ;
endtable();

I have attached an example anycontent.php to this post.

Note;  credit for this code to fotofreek, who submitted this as a mod to the search page, on this thread, http://forum.coppermine-gallery.net/index.php?topic=4768.0