4images Forum & Community

4images Modifications / Modifikationen => Templates & Styles (Requests & Discussions) => Topic started by: Ofuuzo on June 16, 2002, 07:00:03 PM

Title: Meta data
Post 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."&amp;", 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
Title: Re: Meta data
Post by: Jan on June 16, 2002, 07:56:59 PM
Code: [Select]
ShowImage($img_result, URL_IMAGE_ID."=".$image_id."&amp;", 0);

is now:

Code: [Select]
show_image($image_row, 0, 1);
Greets Jan
Title: Meta data
Post by: Ofuuzo on June 17, 2002, 11:15:14 AM
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']
                  ));
Title: Meta data
Post by: Jan on June 17, 2002, 11:21:34 AM
Sorry, use:

Code: [Select]
$site_template->register_vars(array(
  "meta_keywords" => $image_row['image_keywords'],
  "meta_description" => $image_row['image_description']
));


Greets Jan
Title: Meta data
Post by: Ofuuzo on June 17, 2002, 12:52:25 PM
Thanks, it works.

Ofuuzo
Title: Meta data on version 1.61?
Post by: dani2000 on August 06, 2002, 03:19:33 AM
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?
Title: Meta data
Post by: Jan on August 06, 2002, 08:25:06 AM
Use this to show th keywords separated by comma:

Code: [Select]
$site_template->register_vars(array(
  "meta_keywords" => str_replace(" ", ", ", $image_row['image_keywords']),
  "meta_description" => $image_row['image_description']
));


Jan
Title: It works, but....
Post by: dani2000 on August 07, 2002, 03:39:56 AM
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!
Title: Meta data
Post by: Jan on August 07, 2002, 08:41:12 AM
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)
Code: [Select]
$site_template->register_vars(array(
  "meta_keywords" => "some keywords",
  "meta_description" => "little description"
));


maybe just before:
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));
Title: Not working
Post by: dani2000 on August 08, 2002, 03:34:34 AM
Jan, I have tried to do your advice, but did not work! I still see empty meta data on some pages. Any suggestion?
Title: Meta data
Post by: Jan on August 08, 2002, 08:26:40 AM
Can you post a link for pages it doesn't work.

Ja
Title: Difference?
Post by: dani2000 on August 08, 2002, 10:30:50 AM
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?
Title: Meta data
Post by: Jan on August 08, 2002, 10:49:32 AM
See: http://demo.4homepages.de
for me it's working.

Did really used this code:
Code: [Select]
$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
Title: Meta data
Post by: dani2000 on August 09, 2002, 10:42:05 AM
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!
Title: Where to look
Post by: jengwen on January 14, 2003, 10:51:17 PM
Where do you look to see if it is working?
Title: No frames
Post by: jengwen on January 14, 2003, 11:08:53 PM
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?
Title: Meta data
Post by: jengwen on February 11, 2003, 05:19:06 AM
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:
Quote
<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:
Quote
//-----------------------------------------------------
//--- 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)
Quote
//-----------------------------------------------------
//--- 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');
Title: Meta data
Post by: Chris on February 11, 2003, 11:31:34 PM
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.
Title: Re: Meta data
Post by: waleed on March 16, 2005, 04:27:02 AM
for keywords .. should i insert comma between every work ?
Title: Re: Meta data
Post by: Chris on March 16, 2005, 05:03:16 AM
What keywords?  Where?
Title: Re: Meta data
Post by: lapinkulta on June 22, 2005, 03:23:45 PM
great mod, exactly what i need.


only if i add:

Code: [Select]
<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
Title: Re: Meta data
Post by: Vincent on June 27, 2005, 10:13:54 AM
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
Title: Re: Meta data
Post by: Vincent on July 11, 2005, 02:54:55 PM
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
Title: Re: Meta data
Post by: orb42 on August 07, 2007, 09:15:15 AM
Quote
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?


Code: [Select]
//-----------------------------------------------------
//--- 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');