Author Topic: Dynamic Tilte and Description  (Read 518 times)

0 Members and 1 Guest are viewing this topic.

Offline svarog

  • phpd Basic Member
  • **
  • Posts: 30
  • Karma: 0
    • View Profile
Dynamic Tilte and Description
« on: May 14, 2010, 03:50:10 PM »
Pages to change:
header.tpl
index.php
videos.php

In header.tpl

1.Replace <title> statment with:

Code: [Select]
<title>{$config_name}-{if $main_page eq "true"}{section name=ikeywords loop=$videos max=1} {$videos[ikeywords].name}{/section}{else}{section name=vkeywords loop=$video max=1 } {$video[vkeywords].name}{/section}{/if}</title>
result:
Title from the database, set by admin ( FOR all pages) + Title of the first video on the page ( IF it's the main page ) OR + Title of the single video ( IF watching video)

2.Replace <meta name="description"> with:
Code: [Select]
<meta name="description" content="{if $main_page eq "false"} {section name=vdescript loop=$video} {$video[vdescript].description}{/section}{else}{$config_metadescription|default:"YOUR DEFAULT DESCRIPTION"} {/if}" />
and change "YOUR DEFAULT DESCRIPTION " in it.

Result: for videos page - the description of the video being watch, for another page - "YOUR DEFAULT DESCRIPTION"

In index.php add before
Code: [Select]
$smarty->display('index.tpl');
SmartyPaginate::disconnect();
mysql_close($mysql_link);

this:
Code: [Select]
//set keywords show variable
$main_page = true;


$smarty->assign_by_ref('main_page',$main_page);

and in videos.php add befor
Code: [Select]
$smarty->assign('video', $video);
$smarty->assign('id', $row['id']);


if(isset($_GET["pop"])){
$smarty->display('viewvidpop.tpl');
}else{
$smarty->display('viewvid.tpl');
}

mysql_close($mysql_link);

this:
Code: [Select]
//set keywords show variable
$main_page = false;


$smarty->assign_by_ref('main_page',$main_page);

« Last Edit: May 16, 2010, 08:32:44 AM by svarog »