Author Topic: How to change description and keywords META TAG in header  (Read 31785 times)

0 Members and 1 Guest are viewing this topic.

Offline adrianus

  • Pre-Newbie
  • Posts: 4
    • View Profile
How to change description and keywords META TAG in header
« on: August 07, 2007, 06:27:45 PM »
I've seen that some of you are getting personalized header in each page, with different description and keywords meta tag.
How can i do that? Is there a mod for this kind of SEO need?
I'd like to have at least a description tag with trunked description get from image or category description.

Please help me!   :oops:

AD

Offline gino

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: How to change description and keywords META TAG in header
« Reply #1 on: November 19, 2007, 06:30:25 AM »
STUPID ME FORGOT THAT YOU CANT SEE THE BOLD SO PLEASE LOOK AT THE CODE INBETWEEN THE [ b ] and the [ / b ]....that is where the bold was

I will try to help you.  I just downloaded this today and this is the first time looking at the code so there is a simpler way but i dont have time to learn all the code that is in this script and find where the proper code should go.  Basically the easiest way is to duplicate your templates.  Really this is not as hard as you think.  All the information you will need to input into your meta tags are already in your data base you just need to fetch them.  Now the reason why we are going to duplicate them(This is the short cut) is your using two different files to display your website...well at least most of the pages.  There is the main one and the detailed page.  You are going to want to seperate these so you get the max out of the spider that will crawl your page.  Now again this is not really the way to do it but it will work...just not with your rating page and top page ect....if you want to see an example go to peterl.ca...just dont tell my father in law as it is his website :P

First we are going to need to change your meta tages so open up your template/default/header.html
change all the bold spots
Code:  [Select]  [Expand]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{direction}">
<head>
<title>{site_name} - {cat_name}</title>
<meta http-equiv="content-type" content="text/html; iso-8859-1">
<meta name="robots" content="INDEX,FOLLOW">
<meta http-equiv="content-language" content="en">
<meta name="description" content="{cat_description}.">
<meta name="keywords" content="{cat_name} {site_name}">
<meta name="author" content="Laagee Web Design">
<meta name="revisit-after" content="10 days">
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="content-type" content="text/html; charset={charset}" />
<link rel="stylesheet" href="{template_url}/style.css" />

<script language="javascript" type="text/javascript">
<!--

This will automatically change your site to the input in your data base.  Now because we have the detail.php for your pictures this type of meta tag will not due.  Cause it will show the category it is in and your site name for the metas.  So we need to change this part.  This is where it might get complicated so try to follow along.

First we need to start at the source. details.php.  again change the bold spots
Code:  [Select]  [Expand]
$main_template = 'details';

define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'detail_global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/header.php');

if (!$image_id) {
    redirect($url);

Now in your script there is no detailed_global.php  so what we need to do is copy the whole file of global.php and paste it into a blank file and call it detail_global.php.  DO NOT DELETE THE GLOBAL.PHP you still need it!
when your done copy and pasting find the line.
Code: [Select]
include_once(ROOT_PATH.'includes/template.php');Change it to
Code: [Select]
include_once(ROOT_PATH.'includes/detail_template.php');
Now again there is no file called detailed_template.php...so you need to open up your file template.php and like before copy all the contents and name it detail_template.php.
Close to the end of the file you will find this code
Code: [Select]
function print_template($template) {
    if (strpos($template, $this->start.'header'.$this->end) !== false) {
      $header = $this->parse_template("header");
      $template = str_replace($this->start.'header'.$this->end, $header, $template);
    }
Change all the bold lines
Code:  [Select]  [Expand]
function print_template($template) {
    if (strpos($template, $this->start.'detail_header'.$this->end) !== false) {
      $header = $this->parse_template("detail_header");
      $template = str_replace($this->start.'detail_header'.$this->end, $header, $template);
    }
Almost done...now we need to create the detail_header.html.  So go into templates/default/header.html  copy it all and paste it again and name it detail_header.html.  after that you will need to change all the red lines here
Code:  [Select]  [Expand]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{direction}">
<head>
<title>{site_name} - {image_name}</title>
<meta http-equiv="content-type" content="text/html; iso-8859-1">
<meta name="robots" content="INDEX,FOLLOW">
<meta http-equiv="content-language" content="en">
<meta name="description" content="{image_description}.">
<meta name="keywords" content="{image_name} {site_name}">
<meta name="author" content="Laagee Web Design">
<meta name="revisit-after" content="10 days">
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="content-type" content="text/html; charset={charset}" />
<link rel="stylesheet" href="{template_url}/style.css" />

<script language="javascript" type="text/javascript">
<!--

One more thing and we are done.  Open up templates/default/details.html at the very top it will say {header}  change this to {detail_header} and your done.  You will have a site like this http://www.peterl.ca  All the pages have there own unique tags.  I hope this has helped.  And for all the people that actually know this script please post a better way of doing this cause for the guys that dont really know what they are doing it could really help them....CHEERS!
« Last Edit: January 03, 2009, 07:17:30 PM by V@no »

rinaldos

  • Guest
Re: How to change description and keywords META TAG in header
« Reply #2 on: November 21, 2007, 09:20:42 PM »
Hi,
this works, but I changed some of your steps.

First I use the TWEAK from Thunderstrike:
   
[TWEAK] Universal layout - HTML template tags


My first Step was to change /includes/templates.php

find
Code: [Select]
function print_template($template) {
if (strpos($template, $this->start.'header'.$this->end) !== false) {
      $header = $this->parse_template("layout/header");
      $template = str_replace($this->start.'header'.$this->end, $header, $template);
    }

and add after with:
Code: [Select]
if (strpos($template, $this->start.'header_detail'.$this->end) !== false) {
      $header = $this->parse_template("layout/header_detail");
      $template = str_replace($this->start.'header_detail'.$this->end, $header, $template);
    }

The i copied my /templates/default/layout/header.html to /templates/default/layout/header_detail.html

I replaced the META Tags
Code: [Select]
<title>{site_name} - {image_name}</title>
{redirect}
<meta http-equiv="content-type" content="text/html; iso-8859-1">
<meta name="robots" content="INDEX,FOLLOW">
<meta http-equiv="content-language" content="en">
<meta name="description" content="{image_description}.">
<meta name="keywords" content="{image_name} {site_name}">
<meta name="author" content="Rinaldos-World">
<meta name="revisit-after" content="10 days">
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="content-type" content="text/html; charset={charset}" />

and now edit /templates/default/details.html

find:
Code: [Select]
{header}

replace with
Code: [Select]
{header_detail}

And it works also :-)

Thanks for your wonderfull MOD :-)

Gruß
Ingo

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: How to change description and keywords META TAG in header
« Reply #3 on: November 21, 2007, 10:03:10 PM »
Very good - is purfect way for edit template. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

jojomart

  • Guest
Re: How to change description and keywords META TAG in header
« Reply #4 on: January 10, 2008, 09:42:45 PM »
I love love love this mod!

Isn't there someway that for the meta keywords, we can use {image_keywords} instead of {image_name} {site_name} and not have them show on the actual top of the page as links?

Look forward to your help!

Joanne

jojomart

  • Guest
Re: How to change description and keywords META TAG in header
« Reply #5 on: January 12, 2008, 03:32:30 AM »
I don't know if it's something I did wrong (don't think so though), but on my home page, the title is always wrong - it really shouldn't be pointing to a certain category but it does (games - only Good Lord knows why LOL) and then the keywords are from a different category!

Is there some way of making the header for just the main page be keywords that I can actually type in, and then the other pages use the keyword templates?

thanks,

Joanne

Offline Anarchology

  • Jr. Member
  • **
  • Posts: 60
  • I LULZ too much!
    • View Profile
    • Tainted Pix
Re: How to change description and keywords META TAG in header
« Reply #6 on: January 03, 2009, 08:46:52 AM »
Hi,

I had a couple problems integrating this MOD to 1.7.6. I can see this MOD is over a year old, and wondering if there need to be any other needed modifications to certain files? I'll keep trying at it. If I get the error the second time I try it, I'll modify this post and post it up. I'm talking about the main mod posted by member gino.

Thanks in advance

EDIT: This is the error I am getting..
Code: [Select]
Parse error: syntax error, unexpected '[' in /home/site_login/public_html/details.php on line 29
« Last Edit: January 03, 2009, 09:10:32 AM by Anarchology »
A personal THANK YOU to all of the great programmers on this site for helping me get my site from something basic to what it is today!

My site: http://taintedpix.com
(warning: some adult content)

Offline om6acw

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • My Animal's World
Re: How to change description and keywords META TAG in header
« Reply #7 on: January 03, 2009, 06:47:55 PM »
its working for me and Im using 176 version of 4image

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to change description and keywords META TAG in header
« Reply #8 on: January 03, 2009, 07:14:37 PM »
EDIT: This is the error I am getting..
Code: [Select]
Parse error: syntax error, unexpected '[' in /home/site_login/public_html/details.php on line 29
STUPID ME FORGOT THAT YOU CANT SEE THE BOLD SO PLEASE LOOK AT THE CODE INBETWEEN THE [ b ] and the [ / b ]....that is where the bold was


Anyway, I've update the post, it displays properly now.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline om6acw

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • My Animal's World
Re: How to change description and keywords META TAG in header
« Reply #9 on: January 03, 2009, 07:31:15 PM »
would be nice find out how to use {image_keywords} in header with out links just in plain text format.

Quote
<meta name="keywords" content="{image_keywords}">

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to change description and keywords META TAG in header
« Reply #10 on: January 03, 2009, 07:39:13 PM »
in includes/functions.php find:
Code: [Select]
    "image_keywords" => $keywords,
Insert below:
Code: [Select]
    "image_keywords2" => str_replace(" ", ",", $image_row['image_keywords']),
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline om6acw

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • My Animal's World
Re: How to change description and keywords META TAG in header
« Reply #11 on: January 03, 2009, 08:06:30 PM »
Thanks V@ano,
just now with your code this mode its ideal and fully functional.
Thanks a lot!!!

Offline Anarchology

  • Jr. Member
  • **
  • Posts: 60
  • I LULZ too much!
    • View Profile
    • Tainted Pix
Re: How to change description and keywords META TAG in header
« Reply #12 on: January 04, 2009, 12:23:03 AM »
Anyway, I've update the post, it displays properly now.

Ahhh, I'm guessing that there were bold tags accidentally within the coding? I'm going to try this again tonight and post up any errors if I get any. Hopefully this helps me out.

Thanks for the help!

- A
A personal THANK YOU to all of the great programmers on this site for helping me get my site from something basic to what it is today!

My site: http://taintedpix.com
(warning: some adult content)

Offline J.Lond

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: How to change description and keywords META TAG in header
« Reply #13 on: January 12, 2009, 05:21:05 AM »
This method works just as well.  Just create a new header for category and details templates.

http://www.4homepages.de/forum/index.php?topic=15603.0


Best Regards

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: How to change description and keywords META TAG in header
« Reply #14 on: January 12, 2009, 05:59:32 AM »
Hi,

why so mutch work for a new details_header.html  8O

copy your changed code from header.html
and replace in details.html
Code: [Select]
{header}with this code.

Now you can use in details.html all image tags...
Finish...
OK, only the changed code in includes/functions.php is also requiered  :wink:

The same in categories.html and all other templates, if you need different metas


Kurt