Adding post titles from news mod to increase search engine stats

abidan


AzAkers

This works fantastic!

I altered it a bit and used the modified version to pull in the 'short content' into the meta description too.

For the title I reversed the order of the elements - so that the article title appears first, and the website name does not appear in the titles...


<title><?php if ($post_title != ' ') echo $post_titlepage_title('','[PAGE_TITLE]'); ?></title>




NOTE: This effects titles site wide - if you want your website name to remain in your title, but at the end I think you can use something like...


<title><?php if ($post_title != ' ') echo $post_titlepage_title('[PAGE_TITLE]','[WEBSITE_TITLE]'); ?></title>



For the unique description hack I added this initial code (before the doctype - same as the title hack)...


<?php
$query_post 
$database->query("SELECT content_short FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '".$post_id."'");
   if(
$query_post->numRows() > 0) {
       
$post $query_post->fetchRow();
       }
$post_description=$post['content_short'].' ';
?>






and then put this in the meta content..


<meta name="description" content="<?php if ($post_description != ' ') echo $post_description; { echo '  '; } page_description(); ?>" />




I'm no programer so there is probably a more effecient way to accomplish this but I'm tickled pink with myself for managing this much  :lol:

Here is a link to a working sample:
Christian Articles

Click one of the articles there - I linked to the section rather than the individual article since the URL shouldn't change over time

tomhung


hudge

Add this at top of your index.php file in your template
<?php
$query_post 
$database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '".$post_id."'");
   if(
$query_post->numRows() > 0) {
       
$post $query_post->fetchRow();
       }
$post_title=$post['title'].' ';
?>


Add this at top of your index.php file in your head tags of your template
<title><?php page_title(); if ($post_title != ' ') { echo ' - '; } echo $post_title?></title>
: Member of the Baker's Dozen :
Baking at 350˚ for 2 hours now...