Description of the keys Description of the keys
 

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]

Main Menu

Description of the keys

Started by serg5777, June 28, 2016, 08:54:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

serg5777

Hello Αndré. I need to output meta description to set: site.com/thumbnails.php?album=search&keywords=on&search=keyword
<title>keywords - gallery name</title>
<meta name="description" content="All photos on request: keywords" />

How can I display this field?

Αndré

I haven't checked the current behavior. What exactly needs to be added/adjusted? Just the meta tag, the title tag or both?

serg5777

Just a meta tag to "keywords"  :)

Αndré

Copy the function pageheader from themes/sample/theme.php to your theme's theme.php file, if it doesn't already exist there. Then, find
global $template_header, $lang_charset, $lang_text_dir;
and below, add
    global $CPG_PHP_SELF, $USER;
    $superCage = Inspekt::makeSuperCage();
    if ($CPG_PHP_SELF == 'thumbnails.php' && $superCage->get->getAlpha('album') == 'search') {
        $meta .= '<meta name="description" content="All photos on request: '.$USER['search']['search'].'" />';
    }

serg5777


serg5777

Αndré by your example did the description for the last image:
global $CPG_PHP_SELF, $USER;
    $superCage = Inspekt::makeSuperCage();
    if ($CPG_PHP_SELF == 'thumbnails.php' && $superCage->get->getAlpha('album') == 'lastup') {
        $meta.= '<meta name="description" content="Last image - '.$page_num['lastup']['lastup'].'" />';
    }

But something does not work  :-\
$page_num - unsuitable  :-\

serg5777

if ($page > 0)  {
$page_num = '. Page' . ' ' . $page;
    } else  {
        $page_num = '';
    }

global $CPG_PHP_SELF, $USER, $page_num;
    $superCage = Inspekt::makeSuperCage();
    if ($CPG_PHP_SELF == 'thumbnails.php' && $superCage->get->getAlpha('album') == 'lastup') {
        $meta.= '<meta name="description" content="Last image - '.$page_num['lastup']['lastup'].'" />';
    }

Also, it is impossible...

serg5777

I solved a problem addition. Thank you  :)
$section.($page > 1 ? ' - Страница '.$page : '')

serg5777

P.S. "Страница" - this "page" in rus)

serg5777

Quote from: serg5777 on July 18, 2016, 09:33:23 AM
I solved a problem addition. Thank you  :)
$section.($page > 1 ? ' - Page '.$page : '')

serg5777

I'm sorry that so much writing, just try the options)
In general, faced with such a problem:
Quoteglobal $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;
    global $CPG_PHP_SELF, $USER;
    $superCage = Inspekt::makeSuperCage();
    if ($CPG_PHP_SELF == 'thumbnails.php' && $superCage->get->getAlpha('album') == 'search') {
        $meta .= '<meta name="description" content="All photos on request: '.$USER['search']['search']. $section.($page > 1 ? ' - Page '.$page : '').'" />';
    }

Thus duplicated keyword in the description.
<meta name="description" content="All photos on request: keywordkeyword - Страница 7" />

Αndré

Try to remove $section (for whatever reason you added it). I also don't know how
($page > 1 ? ' - Page '.$page : '')
should work, as I cannot that the variable $page is currently set/accessible inside pageheader().

serg5777

I added this section for the reason that you have previously advised it to me. In other topics  :)

serg5777

In thumbnails.php:
pageheader($section.($page > 1 ? ' - Page '.$page : ''), $meta_keywords);

Αndré

As I said, try to remove $section to get rid of the keyword dupes.

serg5777

Happened! Simply remove '$USER'
global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;
    global $CPG_PHP_SELF;
    $superCage = Inspekt::makeSuperCage();
    if ($CPG_PHP_SELF == 'thumbnails.php' && $superCage->get->getAlpha('album') == 'search') {
        $meta .= '<meta name="description" content="All photos on request: '.$USER['search']['search'].$section.($page > 1 ? ' - Page '.$page : '').'" />';
    }

Thank you Αndré! ;)

Αndré

Well, usually $section contains more than just the keyword, e.g. here's the output of a search in my testbed:
QuoteImage search results - "keyword1 keyword2 keyword3"

So you probably have also edited the content of $section somewhere else in your code.