forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: serg5777 on June 28, 2016, 08:54:23 am

Title: Description of the keys
Post by: serg5777 on June 28, 2016, 08:54:23 am
Hello Αndré. I need to output meta description to set: site.com/thumbnails.php?album=search&keywords=on&search=keyword
Code: [Select]
<title>keywords - gallery name</title>
<meta name="description" content="All photos on request: keywords" />
How can I display this field?
Title: Re: Description of the keys
Post by: Αndré on June 30, 2016, 09:14:47 pm
I haven't checked the current behavior. What exactly needs to be added/adjusted? Just the meta tag, the title tag or both?
Title: Re: Description of the keys
Post by: serg5777 on July 01, 2016, 08:23:46 am
Just a meta tag to "keywords"  :)
Title: Re: Description of the keys
Post by: Αndré on July 12, 2016, 03:38:15 pm
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
Code: [Select]
global $template_header, $lang_charset, $lang_text_dir;and below, add
Code: [Select]
    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'].'" />';
    }
Title: Re: Description of the keys
Post by: serg5777 on July 13, 2016, 01:39:34 pm
Working! Many thanks!  ;)
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 08:58:14 am
Αndré by your example did the description for the last image:
Code: [Select]
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  :-\
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 09:12:37 am
Code: [Select]
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...
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 09:33:23 am
I solved a problem addition. Thank you  :)
Code: [Select]
$section.($page > 1 ? ' - Страница '.$page : '')
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 09:34:24 am
P.S. "Страница" - this "page" in rus)
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 09:34:59 am
I solved a problem addition. Thank you  :)
Code: [Select]
$section.($page > 1 ? ' - Page '.$page : '')
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 10:02:57 am
I'm sorry that so much writing, just try the options)
In general, faced with such a problem:
Quote
global $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.
Code: [Select]
<meta name="description" content="All photos on request: keywordkeyword - Страница 7" />
Title: Re: Description of the keys
Post by: Αndré on July 18, 2016, 10:09:57 am
Try to remove $section (for whatever reason you added it). I also don't know how
Code: [Select]
($page > 1 ? ' - Page '.$page : '')should work, as I cannot that the variable $page is currently set/accessible inside pageheader().
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 10:18:22 am
I added this section for the reason that you have previously advised it to me. In other topics  :)
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 10:24:14 am
In thumbnails.php:
Code: [Select]
pageheader($section.($page > 1 ? ' - Page '.$page : ''), $meta_keywords);
Title: Re: Description of the keys
Post by: Αndré on July 18, 2016, 10:30:49 am
As I said, try to remove $section to get rid of the keyword dupes.
Title: Re: Description of the keys
Post by: serg5777 on July 18, 2016, 10:31:31 am
Happened! Simply remove '$USER'
Code: [Select]
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é! ;)
Title: Re: Description of the keys
Post by: Αndré on July 18, 2016, 10:35:43 am
Well, usually $section contains more than just the keyword, e.g. here's the output of a search in my testbed:
Quote
Image search results - "keyword1 keyword2 keyword3"

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