osclass ( formarly known as openclassifieds ) is a php script that allows you to quickly create and manage your own free classifieds site. osclass is an open source project that allows you to easily create a classifieds site without any technical knowledge.
We have been using openclassifieds for many years now, and on thing we always wanted to have is use custom meta description for every page generated by every new ad published on our website. Having unique “meta description” for every page helps a lot with SEO, search engine optimisation.
To Achieve this, we changed, themes/default/views/header_metas.php from
<meta name="description" content="<?=HTML::chars($meta_description)?>" >
Change to,
<?if (Model_Ad::current()!==NULL AND Model_Ad::current()->loaded()):?>
<meta name="description" content="<?=Model_Ad::current()->description?>"/>
<?else:?>
<meta name="description" content="<?=HTML::chars($meta_description)?>" >
<?endif?>
If we want to restrict meta description length to recent google standard upto 160 charachters, change the code as below,
<meta name="description" content="<?=Text::limit_chars(Model_Ad::current()->description, 155, NULL, TRUE)?>"/>