forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started 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
<title>keywords - gallery name</title>
<meta name="description" content="All photos on request: keywords" />
How can I display this field?
-
I haven't checked the current behavior. What exactly needs to be added/adjusted? Just the meta tag, the title tag or both?
-
Just a meta tag to "keywords" :)
-
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'].'" />';
}
-
Working! Many thanks! ;)
-
Α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 :-\
-
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...
-
I solved a problem addition. Thank you :)
$section.($page > 1 ? ' - Страница '.$page : '')
-
P.S. "Страница" - this "page" in rus)
-
I solved a problem addition. Thank you :)
$section.($page > 1 ? ' - Page '.$page : '')
-
I'm sorry that so much writing, just try the options)
In general, faced with such a problem:
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.
<meta name="description" content="All photos on request: keywordkeyword - Страница 7" />
-
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().
-
I added this section for the reason that you have previously advised it to me. In other topics :)
-
In thumbnails.php:
pageheader($section.($page > 1 ? ' - Page '.$page : ''), $meta_keywords);
-
As I said, try to remove $section to get rid of the keyword dupes.
-
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é! ;)
-
Well, usually $section contains more than just the keyword, e.g. here's the output of a search in my testbed:
Image search results - "keyword1 keyword2 keyword3"
So you probably have also edited the content of $section somewhere else in your code.