Title Tag on Home Page Title Tag on Home Page
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Title Tag on Home Page

Started by malooga, September 25, 2005, 07:26:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

malooga

I've managed to customize the title tag on all the pages in my gallery by editing the language file and theme.php. It now shows the title of the picture followed by the album name followed by the gallery name. This works great for picture pages and album index pages. The only thing I can't figure out is how to customize the home page title tag. The problem is if I edit the Home in the language file this also changes the breadcrumb. How can I make a totally custom home page title tag without affecting the breadcrumb or any of the other gallery pages? Thanks in advance.

malooga

I hate talking to myself, but does anyone know how to do this?   :)

Tranz

Try template.html. ooh, but it will be the same for all pages.  :-\\

malooga

Quote from: TranzNDance on September 27, 2005, 07:34:14 AM
Try template.html. ooh, but it will be the same for all pages.  :-\\

Yes, that's the problem. To optimize for search engines, you need a unique title on every page ideally. I have accomplished this, except for the home page which I can't figure out.

malooga

I assume from the lack of replies that no one knows how to do this. Can one of the veterans here comment? If it can't be done, I'll move on. Thanks.

artistsinhawaii

#5
Malooga,

Don't know if this will work...haven't tried it myself, but I think the approach is going to be in your init.inc.php file in the include folder.

1) Make a copy of your theme folder and rename it theme_name2
2) Make the necessary change in this theme's template.html file.

3) Open include/init.inc.php look for the following:


if (!file_exists("themes/{$CONFIG['theme']}/theme.php")) $CONFIG['theme'] = 'classic';
require "themes/{$CONFIG['theme']}/theme.php";
$THEME_DIR = "themes/{$CONFIG['theme']}/";


4) Next, add an 'IF' and '} else {' statement to this before this code[/b.



if ($_GET["album"] == '' ) {
     $theme='yourtheme_shop_1';
       require "themes/yourtheme_shop_1/theme.php";
       $THEME_DIR = "themes/yourtheme_shop_1/";
}  else {

if (!file_exists("themes/{$CONFIG['theme']}/theme.php")) $CONFIG['theme'] = 'classic';
require "themes/{$CONFIG['theme']}/theme.php";
$THEME_DIR = "themes/{$CONFIG['theme']}/";
}


NOTE:  $_GET["album"] == ''   <--true if there is no album number or name (1, -1, 0, lastup, random) so this should cause init.inc.php to display your theme_name2.  Otherwise it should display the theme of your choice for all other options.


Dennis
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

Stramm

Ok, in template.html next to {TITLE} add eg. {ENHANCE}

theme php -> function pageheader($section, $meta = '')
make HTTP_GET_VARS a global
below the global definition
if (!isset($HTTP_GET_VARS['cat']))$add = "Text that only appeares on the index when cat is not selected... you can enhance the if with eg $HTTP_GET_VARS['cat'] ==0 || !isset($HTTP_GET_VARS['cat'])";


in $template_vars a few lines below add
'{ENHANCE}'=> $add,


this will display $add only in the title of index.php when cat isn't set... the alternative will define $add too when cat=0... means only in the front page and not when viewing a category

artistsinhawaii

Phew, that's simpler than my approach.

Let me stick a copy of this into my little 'tool box'... thanks Stramm

Dennis
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

Stramm

the standard way to add dynamic content if anycontent won't do the trick

I've always wanted to write an howto. Example would be a username/ password box  on top of the page seen only be anon users. If logged in it gets replaced by a 'Welcome back usernaeme' and if a PM mod is installed... Private Messages: x unread, total xx

Joachim Müller

Quote from: Stramm on September 30, 2005, 12:07:48 PM
I've always wanted to write an howto.
That would be great! Please go ahead.

;D Joachim

zzz

did this howto ever get made?

Joachim Müller

obviously, nobody has done it so far. Why don't you do it?

zzz

apologies,

i was asking from the point of view of not knowing therefore i wouldnt know where to start on the matter.

Stramm

you could download my modpack... if you know how to read code you can easily find out where to start

hint: in 1.4x it's themes.inc.php

Joachim Müller

themes.inc.php should never be modified, under no circumstances. This should be done instead in the custom theme (theme.php), with code sections copied over from themes/sample/theme.php or themes.inc.php

Stramm

you're right... what I meant is that zzz can have a look at the changes I mdae in my modpack's themes.inc.php. With that info it's easy to add functions to theme.php