Forum Moderators: coopster

Message Too Old, No Replies

Solve SEO problem from smarty

SEO problem in Smarty

         

James47

11:43 am on May 31, 2007 (gmt 0)

10+ Year Member



I had used smarty in my last project but now arising a problem that is SEO problem. How to solve it. SEO not considered the .tpl files.Plese help me .

Habtom

11:46 am on May 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What exactly do you want? Does smarty stop you from SEO?

Hab

bkeep

4:22 pm on Jun 3, 2007 (gmt 0)

10+ Year Member



Smarty does not stop you from performing SEO There are several methods one could use and I would think its all preference.

One method could be to use a language file and define each pages keywords, description, and title in that and include it in your php page


define("PAGE1_TITLE", "Your page title");
define("PAGE1_KEYWORDS", "keyword1,keyword2,keyword3");
define("PAGE1_DESCRIPTION", "Description of my site");

Then in your tpl call it like so


{$smarty.const.PAGE1_TITLE}
{$smarty.const.PAGE1_KEYWORDS}
{$smarty.const.PAGE1_DESCRIPTION}

Another option is to assign your information in the php file like so

$title = "Your page title";
$keywords = "keyword1,keyword2,keyword3";
$description = "Description of my site";

$smarty->assign('title',$title);
$smarty->assign('keywords',$keywords);
$smarty->assign('description',$description);

then in your .tpl file


<title>{$title</title>
<meta name="description" content="{$description}" />
<meta name="keywords" content="{$keywords}" />

This is just a couple different ways I have used your milage may very
Regards,
Brandon

hughie

6:11 pm on Jun 3, 2007 (gmt 0)

10+ Year Member



surely smarty is beneficial to your SEO because it gives such great control over everything.

I simply have a table in the database which contains all the relevant page info.

Page_ID File_Name Title Header_1 Header_2 etc.

I then match the filename of the requested page, and pull in all of the relevant info into an array

$smarty->assign('PageInfo',$PageArray);

Then within smarty i just reference it where needed

<title>{$PageArray.Title}</title>