4images Forum & Community
4images Modifications / Modifikationen => Templates & Styles (Requests & Discussions) => Topic started by: Ofuuzo on June 16, 2002, 07:00:03 PM
-
Hi,
In version 1.0, meta data can be added as follows:
file /templates/default/head.html:
<head>
....
<meta name="dc.description" content="{meta_description}">
<meta name="dc.keywords" content="{meta_keywords}">
..
</head>
and in file /details.php below line code:
ShowImage($img_result, URL_IMAGE_ID."=".$image_id."&", 0);
the following is inserted;
$site_template->register_vars(array("meta_description" =>
$img_result['image_description'],
"meta_keywords" => $img_result['image_keywords']
));
Can you point me in which files I have to look or how I can do that in version 1.5.
Thanks in advance.
- Ofuuzo
-
ShowImage($img_result, URL_IMAGE_ID."=".$image_id."&", 0);
is now:
show_image($image_row, 0, 1);
Greets Jan
-
I tried to insert the follwing after
show_image($image_row, 0, 1);
and it is not working.
$site_template->register_vars(array(
"meta_keywords" => $img_row['image_keywords'],
"meta_description" => $img_row['image_description']
));
-
Sorry, use:
$site_template->register_vars(array(
"meta_keywords" => $image_row['image_keywords'],
"meta_description" => $image_row['image_description']
));
Greets Jan
-
Thanks, it works.
Ofuuzo
-
But how to do it on version 1.61? I try using this method but when I check to the meta data, I see the keywords but does not separated by comma. I think by using this method the keywords and description in the index would be empty! Any suggestion?
-
Use this to show th keywords separated by comma:
$site_template->register_vars(array(
"meta_keywords" => str_replace(" ", ", ", $image_row['image_keywords']),
"meta_description" => $image_row['image_description']
));
Jan
-
Thank you Jan, it works! But the problem arise with the index (home) and some of the pages. I see only empty meta data! How to fix this! Thanx!
-
This works only for the detail page. You have to register the meta data in all other main pages too.
Put this in all main php files (index.php, categories.php, lightbox.php, member.php, postcards.php, register.php. search.php, top.php)
$site_template->register_vars(array(
"meta_keywords" => "some keywords",
"meta_description" => "little description"
));
maybe just before:
$site_template->print_template($site_template->parse_template($main_template));
-
Jan, I have tried to do your advice, but did not work! I still see empty meta data on some pages. Any suggestion?
-
Can you post a link for pages it doesn't work.
Ja
-
Sorry, I have not uploaded these files yet, 'cause I tried it first on my computer and using personal server (I use apache, PHP, and mysql). Do you think that the result would be different?
-
See: http://demo.4homepages.de
for me it's working.
Did really used this code:
$site_template->register_vars(array(
"meta_keywords" => "some keywords",
"meta_description" => "little description"
));
Replace "some keywords" and "little desription". I'm not using $image_row['xxx'] here!
Jan
-
Now it's working.....! I made a mistake by putting the code on the wrong line! After I corrected it..... aha... it's working! Thanx you for your help. Just for suggestion: next version it would be great if you have forum on it. Thanx!
-
Where do you look to see if it is working?
-
I am using version 1.7 and when I entered my site w/o frames, I could see the general meta data I entered in my header file. I think that was my problem.
I have another question... What is the purpose of adding meta data for each image? Can search engines pick it up if you are using variables like that?
-
Finally got this working and it works great! Since the full directions are kind of broken up, here is a summary. New lines are in bold.
Change header.html:
<title>{site_name}</title>
<meta http-equiv="content-type" content="text/html; charset={charset}" />
<meta name="description" content="{meta_description}">
<meta name="keywords" content="{meta_keywords}">
<link rel="stylesheet" href="{template_url}/style.css" />
Change details.php:
//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------
$image_allow_comments = (check_permission("auth_readcomment", $cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name = htmlspecialchars($image_row['image_name']);
show_image($image_row, $mode, 0, 1);
$site_template->register_vars(array(
"meta_keywords" => str_replace(" ", ", ", $image_row['image_keywords']),
"meta_description" => $image_row['image_description']
));
Other files to change:
index.php
top.php
search.php
register.php
postcards.php
member.php
lightbox.php
categories.php
quotation.php (if you did the lightbox quote mod)
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream
));
$site_template->register_vars(array(
"meta_keywords" => "enter your keywords here",
"meta_description" => "enter your site description here"
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
-
Because the subsequent pages are generated by server side scripts, links to other php files represent a possible infinite URL space. Because of this possibility most search engines won't follow those links links so they're not likely to ever see the meta tags. :(
Just my experience and what Google, Inktomi, etc have to say about pages that are dynamically generated.
-
for keywords .. should i insert comma between every work ?
-
What keywords? Where?
-
great mod, exactly what i need.
only if i add:
<meta name="description" content="{meta_description}" />
<meta name="keywords" content="{meta_keywords}" />
to the header.html, description and keywords are not displayed.
If I add the fields {meta_description} and {meta_keywords} directly in the let's say home.html template, they show up.
What could this be?
Greetings,
lapinkulta
-
if i would like to get information to a categorie! how and where could i do this?
in the detail page i belive it works - waiting of a robot! :wink:
sincerly
vincent
-
I have added this mod a couple of weeks ago!
but the search engine are not using the information in the meta tag!
in my case for problem solving only in the detail.php
why not?
sincerly
vincent
-
Change header.html:
<title>{site_name}</title>
<meta http-equiv="content-type" content="text/html; charset={charset}" />
<meta name="description" content="{meta_description}">
<meta name="keywords" content="{meta_keywords}">
<link rel="stylesheet" href="{template_url}/style.css" />
Change details.php:
//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------
$image_allow_comments = (check_permission("auth_readcomment", $cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name = htmlspecialchars($image_row['image_name']);
show_image($image_row, $mode, 0, 1);
$site_template->register_vars(array(
"meta_keywords" => str_replace(" ", ", ", $image_row['image_keywords']),
"meta_description" => $image_row['image_description']
));
Other files to change:
index.php
top.php
search.php
register.php
postcards.php
member.php
lightbox.php
categories.php
quotation.php (if you did the lightbox quote mod)
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream
));
$site_template->register_vars(array(
"meta_keywords" => "enter your keywords here",
"meta_description" => "enter your site description here"
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
Where to put this part please?
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream
));
$site_template->register_vars(array(
"meta_keywords" => "enter your keywords here",
"meta_description" => "enter your site description here"
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');