Welcome to Geeklog, Anonymous Thursday, June 20 2024 @ 01:28 am EDT

Geeklog Forums

meta tags / alt tags / div / javascript


Status: offline

Mapp

Forum User
Newbie
Registered: 08/13/03
Posts: 8
I\'ve hacked the Geeklog code and made a few small changes that make it pretty easy to insert the meta tags (keywords) and the alt tags for images and also to \"float\" a flash layer over the geeklog page. I\'m still trying to get a good grasp of the Geeklog code so what I have might not be the finished version (my finished that is) but it works and seems intuitive. I\'ll post the code I wrote, I viewed old posts and searched the forums and as far as I can see there hasn\'t been any code to do these tasks yet, but if I missed something, let me know. However, two things first before I move on to something else and post the code I have --- I\'ve been setting the alt tags like so ..... [image1 alt=\"Picture of Grand Canyon\"] .... (instead of just [image1]) does that seem reasonable? Any other potential attributes I should include while I\'m at it? Align? As far as the meta tags go, I\'ve added these lines for example to the config.php file ...... $_CONF[\'meta_keywords\'] = \'realestate, realty, listings\'; $_CONF[\'meta_description\'] = \'An independant site concerning Nanaimo and real estate\'; $_CONF[\'head_javascript\'] = \'\'; $_CONF[\'body_javascript\'] = \'startFlashFixed(0,0,\"http://nanaimo-realty.com/JabberFlash/JabberBot.swf\",800,600);\'; .... does this seem reasonable? You can\'t specify different keywords for each page (yet) so these keywords get used on each page. Any thoughts before I post the code? Greg.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Here\'s a thought: Now that Geeklog allows plugins to insert meta tags etc. into the site\'s header (via the plugin_getheadercode_pluginname function) why not create a (simple) plugin that lets you edit those? This wouldn\'t require any changes to Geeklog\'s core code and it would be much more comfortable than having to edit config.php. bye, Dirk
 Quote

Status: offline

Mapp

Forum User
Newbie
Registered: 08/13/03
Posts: 8
Well, I haven\'t quite got the plug in thing down. However, I don\'t see any problem about putting metatags in the config.php file. I note that the title of the page is set within that file and it just seems to me that I really don\'t want to tell someone they have to install a plug in to have their site description and keywords. I can\'t recall a time when I didn\'t include keywords and description as practically the first thing I put on any HTML page. Frankly, I was quite surprised that there was no \"core\" way of doing this. Is there some reason why I definitely wouldn\'t want to have description and keyword meta tags? Anyway, I\'m just going to change my files as I think those two meta tags are really an essential part of any html web page and furthermore it also seems to me that if I were just starting with Geeklog which in fact I am, and the config.php file is the obvious place to put the keywords and description. I wouldn\'t expect to write a \"get title\" plugin nor do I expect to have to install a plugin to have keywords and meta tags. The javascript stuff maybe I\'ll make a plug in for, but again probably not. It seems to me that if I\'m going to deal with cookies in the config file then my javascript might as well be there too. Regardless, that is how it seems to me. I\'m not trying to be difficult but I have a difficult time imagining myself explaining to clients that the title of the page is in the config file, but the keywords and description are in a plugin. The real question I have though is what about the alt tags? Does it seem right to use \"[image1 alt=\"picturename\"] syntax? greg.
 Quote

Status: offline

Mapp

Forum User
Newbie
Registered: 08/13/03
Posts: 8
In the lib-common.php file .... line 903 --
Text Formatted Code
$tmp = str_replace("", "nnn".$_CONF['head_javascript'], $tmp);
line 994 --
Text Formatted Code
return str_replace("",$_CONF['body_javascript']."n",$footer->finish( $footer->get_var( 'index_footer' )));
Line 903 is added to the empty line , line 994 replaces. To get the alt tags slot this in after line 617 in the /public_html/admin/story.php file after "$nrows = DB_numRows($result);" and before the existing line 629 "$errors = array();".....
Text Formatted Code
    $pieces = explode("[image", $body); foreach ($pieces as $key => $value) { $pos = strpos($value, "]");
        $theAttributes = substr($value, 1, $pos-1);
        $theAltTags[] = substr($theAttributes, 7, -1);
        $pieces[$key] = str_replace($theAttributes,"", $value);
    }
    $body = implode("[image",$pieces);[/code]


... then, replace the existing line 656 with this ....  

[code]$body = str_replace($norm, $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="'.$theAltTags[$i].'">' . $lLinkSuffix, $body);
.... and that should do it. The examples that go into config.php are in the first post. My apologies if this isn't really the right way to do it, I needed it right now and so I did it. I'll figure out the plugin strategy later on. Greg.
 Quote

All times are EDT. The time is now 01:28 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content