Put category and subcategory in title

ClassiBase classifieds script Forums General help Put category and subcategory in title

This topic contains 2 replies, has 2 voices, and was last updated by  Dmitry Grunt 1 year, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2434 Reply

    Dmitry Grunt
    Participant

    By defaut script generates titles with only one category name – for example:
    “job offer name” + Medicine.
    I need titles like this:

    “job offer name” + Medicine + Job

    How can i get variable with this category names in contorller?

    #2440 Reply

    ClassiBase
    Keymaster

    Currently page title on ad page generated as “Ad title” + “Location” + “Site title”
    Location and site title added only if title less than 50 characters. This is done to keep page title around 65 characters (suggested for SEO).

    If you want to change this title generation and willing to edit core files then open /sys/app/controllers/IndexController.php file and navigate to item method.

    Look for lines containing following code.

    // set title 
    		$title = $ad->title;
    		if(strlen($title) < 50)
    		{
    			// add location and site name 
    			if($ad->Location)
    			{
    				$title .= ' - ' . Location::getName($ad->Location);
    			}
    			if(strlen($title) < 50)
    			{
    				// add site name 
    				$title .= ' - ' . Config::option('site_title');
    			}
    		}
    		$this->setMeta('title', $title);

    Change it with this:

    ‘// set title
    $title = $ad->title;
    if(strlen($title) < 50) { // add location and site name if($ad->Category)
    {
    $title .= ‘ – ‘ . Category::getFullName($ad->Category,”,’ ‘);
    }
    if(strlen($title) < 50) { // add site name $title .= ' - ' . Config::option('site_title'); } } $this->setMeta(‘title’, $title);’

    This will use full category name with parent category names separated by space in title.

    These are default values for getFullName method:

    public static function getFullName($location = 0, $empty_value = '', $seperator = ' &raquo; ', $reverse = false)

    Also keep in mind on next script update you will loose all these changes.

    Regards.

    #2443 Reply

    Dmitry Grunt
    Participant

    Thank you for help!
    With this tweak all titles will be unique without duplication.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Put category and subcategory in title
Your information: